WGU D335 Introduction to
Programming in Python Objective
Assessment Exam 2025/2026 –
Questions with Verified Correct
Solutions (100% Guaranteed Pass)
Question 1
Write a program that takes a 9-digit number as input and formats it as a string with dashes, like
XXX-XX-XXXX (e.g., 123456789 becomes 123-45-6789).
Answer: Blue Answer: Take the input number, check if it’s a 9-digit number, split it into
the first three digits, the next two digits, and the last four digits, then combine them with dashes
and print the result.
Red Explanation: The program needs to ensure the input is a valid 9-digit number (between
100000000 and 999999999). It extracts the first three digits, the next two, and the last four using
division and remainder operations. Then, it formats these parts into a string with dashes (e.g.,
123-45-6789) and displays it.
Question 2
You have a list of numbers: 4, -27, 15, 33, -10. Write a program that takes a number as input and
checks if it’s greater than the largest number in the list. Output the result as "Greater Than Max?
True" or "Greater Than Max? False".
Answer: Blue Answer: Read the input number, find the largest value in the list, compare the
input to it, and print "Greater Than Max?" followed by True if the input is larger or False if it’s
not.
Red Explanation: The largest number in the list is 33. The program compares the input
number to 33. If the input is greater than 33, it outputs "Greater Than Max? True"; otherwise, it
outputs "Greater Than Max? False".
, 2
Question 3
Write a program that takes a string input and counts how many vowels (a, e, i, o, u) it contains,
then prints the count.
Answer: Blue Answer: Read the string, count the occurrences of a, e, i, o, and u (ignoring
case), and print the total count.
Red Explanation: The program reads a string input and checks each character to see if it’s a
vowel (a, e, i, o, u, in any case). It keeps a running total of vowels found and prints the final
count. For example, "Hello" has 2 vowels (e and o).
Question 4
Create a program that accepts a positive integer and checks if it’s a prime number. Output
"Prime? True" or "Prime? False".
Answer: Blue Answer: Read the number, check if it’s greater than 1, then test if it has any
divisors other than 1 and itself. Print "Prime? True" if it’s prime, or "Prime? False" if it’s not.
Red Explanation: A prime number is greater than 1 and divisible only by 1 and itself. The
program checks if the input is greater than 1, then tests divisibility by numbers from 2 up to the
square root of the input. If no divisors are found, it’s prime, and the program outputs "Prime?
True"; otherwise, it outputs "Prime? False".
Question 5
Write a program that takes a positive integer and calculates the sum of all even numbers from 1
to that number. Print the sum.
Answer: Blue Answer: Read the number, loop through numbers from 1 to the input, add up
only the even numbers, and print the total.
Red Explanation: The program reads a positive integer, then iterates from 1 to that number,
checking each number to see if it’s even (divisible by 2 with no remainder). It adds each even
number to a running total and prints the final sum. For example, if the input is 6, it sums 2 + 4 +
6 = 12.