Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 51 pages
Exam (elaborations)

WGU D335 INTRODUCTION TO PROGRAMMING IN PYTHON - PERFORMANCE ASSESSMENT (PA) 100 CODING PRACTICE QUESTIONS WITH VERIFIED SOLUTIONS

Document preview thumbnail
Preview 4 out of 51 pages

WGU D335 INTRODUCTION TO PROGRAMMING IN PYTHON - PERFORMANCE ASSESSMENT (PA) 100 CODING PRACTICE QUESTIONS WITH VERIFIED SOLUTIONS

Content preview

WGU D335 INTRODUCTION TO
PROGRAMMING IN PYTHON -
PERFORMANCE ASSESSMENT (PA)
100 CODING PRACTICE
QUESTIONS WITH VERIFIED
SOLUTIONS

SECTION ONE: QUESTIONS 1–100


Question 1
Problem: Write a program that takes an integer input from the user and
prints "Even" if the number is even, and "Odd" if the number is odd.
Solution:
python
num = int(input())
if num % 2 == 0:
print("Even")
else:
print("Odd")

RATIONALE: The modulus operator % returns the remainder. If num
% 2 == 0, the number is evenly divisible by 2, making it even.

,Question 2
Problem: Write a program that takes two integer inputs and prints their
sum, difference, product, and quotient (as a float).
Solution:
python
a = int(input())
b = int(input())
print("Sum:", a + b)
print("Difference:", a - b)
print("Product:", a * b)
print("Quotient:", a / b)

RATIONALE: Basic arithmetic operations are performed in Python.
Division / always returns a float. Output formatting must match exactly
as shown.


Question 3
Problem: Write a program that takes a string input and prints it in
reverse order.
Solution:
python
text = input()
print(text[::-1])

RATIONALE: The slice [::-1] starts at the end and moves backwards
with a step of -1, effectively reversing the string.

,Question 4
Problem: Write a program that takes a list of three integers and prints
the largest number.
Solution:
python
a = int(input())
b = int(input())
c = int(input())
largest = max(a, b, c)
print("Largest:", largest)

RATIONALE: The built-in max() function returns the highest value
among its arguments.


Question 5
Problem: Write a program that takes a temperature in Celsius and
converts it to Fahrenheit. Formula: F = (C * 9/5) + 32. Output to one
decimal place.
Solution:
python
celsius = float(input())
fahrenheit = (celsius * 9/5) + 32
print("Fahrenheit: {:.1f}".format(fahrenheit))

RATIONALE: The conversion formula is applied. .1f formats the
output to one decimal place.

, Question 6
Problem: Write a program that takes a string input and counts the
number of vowels (a, e, i, o, u) in it.
Solution:
python
text = input().lower()
vowels = "aeiou"
count = 0
for char in text:
if char in vowels:
count += 1
print("Vowels:", count)

RATIONALE: The string is converted to lowercase to handle
uppercase inputs. Each character is checked against the vowel set.


Question 7
Problem: Write a program that takes an integer n and prints all
numbers from 1 to n on a single line, separated by spaces.
Solution:
python
n = int(input())
for i in range(1, n + 1):
print(i, end=" ")

RATIONALE: range(1, n+1) generates numbers from 1 to n
inclusive. end=" " keeps output on one line with spaces.

Document information

Uploaded on
September 5, 2026
Number of pages
51
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$26.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
177
Followers
6
Items
2183
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions