WGU D335 Python Programming Exam – Accurate
Answers To All Questions
Student Identification Number Correct Answer - A 9-digit
unformatted integer input representing a student's ID.
Formatted Student ID Output Correct Answer - The output
format for the student ID is <ssn>.
Input Validation for Student ID Correct Answer - The student
ID must be between 100000000 and 999999999.
Formatted ID Construction Correct Answer - The formatted ID
is constructed using parts derived from the student ID.
Predefined List Correct Answer - A list containing the values
[4, -27, 15, 33, -10].
Boolean Value Output Correct Answer - Indicates whether the
input value is greater than the maximum value from predef_list.
Max Value Calculation Correct Answer - The maximum value
from predef_list is calculated using the max() function.
Frameworks List Correct Answer - A list of web frameworks:
['Django', 'Flask', 'CherryPy', 'Bottle', 'Web2Py', 'TurboGears'].
Index Value Input Correct Answer - An integer input
representing the index of a string element in the frameworks list.
Exception Handling Correct Answer - A try block that raises an
'Error' for incompatible integer inputs.
,Water Temperature Input Correct Answer - An integer input
representing water temperature in degrees Fahrenheit.
Water State Description Correct Answer - Describes the state
of water based on temperature ranges.
Frozen Water State Correct Answer - Water is 'Frozen' if the
temperature is below 33° F.
Cold Water State Correct Answer - Water is 'Cold' if the
temperature is between 33° F and 80° F.
Warm Water State Correct Answer - Water is 'Warm' if the
temperature is between 80° F and 115° F.
Hot Water State Correct Answer - Water is 'Hot' if the
temperature is between 115° F and 211° F.
Boiling Water State Correct Answer - Water is 'Boiling' if the
temperature is greater than or equal to 212° F.
water_state Correct Answer - Describes the state of water
based on temperature.
optional_safety_comment Correct Answer - Safety comment
displayed based on specific water temperatures.
temperature Correct Answer - The current temperature of the
water.
Frozen Correct Answer - State of water when temperature is
less than 33° F.
, Cold Correct Answer - State of water when temperature is
between 33° F and 80° F.
Warm Correct Answer - State of water when temperature is
between 80° F and 115° F.
Hot Correct Answer - State of water when temperature is
between 115° F and 212° F.
Boiling Correct Answer - State of water when temperature is
212° F or higher.
Caution: Hot! Correct Answer - Safety comment displayed
when water temperature is exactly 212° F.
Watch out for ice! Correct Answer - Safety comment displayed
when water temperature is less than 33° F.
Reverse Binary Correct Answer - Representing an integer in
reverse binary by outputting remainders of division by 2.
__name__ == '__main__' Correct Answer - Used to separate the
main code from the function's code for unit testing.
Driving Cost Function Correct Answer - Function taking miles
per gallon, price per gallon, and miles driven to return the dollar
cost.
Coin Flip Function Correct Answer - Function returning
'Heads' or 'Tails' based on a random value of 1 or 0.
Unit Tests Correct Answer - Testing small parts of a program
in an isolated manner to ensure they work as expected.
Answers To All Questions
Student Identification Number Correct Answer - A 9-digit
unformatted integer input representing a student's ID.
Formatted Student ID Output Correct Answer - The output
format for the student ID is <ssn>.
Input Validation for Student ID Correct Answer - The student
ID must be between 100000000 and 999999999.
Formatted ID Construction Correct Answer - The formatted ID
is constructed using parts derived from the student ID.
Predefined List Correct Answer - A list containing the values
[4, -27, 15, 33, -10].
Boolean Value Output Correct Answer - Indicates whether the
input value is greater than the maximum value from predef_list.
Max Value Calculation Correct Answer - The maximum value
from predef_list is calculated using the max() function.
Frameworks List Correct Answer - A list of web frameworks:
['Django', 'Flask', 'CherryPy', 'Bottle', 'Web2Py', 'TurboGears'].
Index Value Input Correct Answer - An integer input
representing the index of a string element in the frameworks list.
Exception Handling Correct Answer - A try block that raises an
'Error' for incompatible integer inputs.
,Water Temperature Input Correct Answer - An integer input
representing water temperature in degrees Fahrenheit.
Water State Description Correct Answer - Describes the state
of water based on temperature ranges.
Frozen Water State Correct Answer - Water is 'Frozen' if the
temperature is below 33° F.
Cold Water State Correct Answer - Water is 'Cold' if the
temperature is between 33° F and 80° F.
Warm Water State Correct Answer - Water is 'Warm' if the
temperature is between 80° F and 115° F.
Hot Water State Correct Answer - Water is 'Hot' if the
temperature is between 115° F and 211° F.
Boiling Water State Correct Answer - Water is 'Boiling' if the
temperature is greater than or equal to 212° F.
water_state Correct Answer - Describes the state of water
based on temperature.
optional_safety_comment Correct Answer - Safety comment
displayed based on specific water temperatures.
temperature Correct Answer - The current temperature of the
water.
Frozen Correct Answer - State of water when temperature is
less than 33° F.
, Cold Correct Answer - State of water when temperature is
between 33° F and 80° F.
Warm Correct Answer - State of water when temperature is
between 80° F and 115° F.
Hot Correct Answer - State of water when temperature is
between 115° F and 212° F.
Boiling Correct Answer - State of water when temperature is
212° F or higher.
Caution: Hot! Correct Answer - Safety comment displayed
when water temperature is exactly 212° F.
Watch out for ice! Correct Answer - Safety comment displayed
when water temperature is less than 33° F.
Reverse Binary Correct Answer - Representing an integer in
reverse binary by outputting remainders of division by 2.
__name__ == '__main__' Correct Answer - Used to separate the
main code from the function's code for unit testing.
Driving Cost Function Correct Answer - Function taking miles
per gallon, price per gallon, and miles driven to return the dollar
cost.
Coin Flip Function Correct Answer - Function returning
'Heads' or 'Tails' based on a random value of 1 or 0.
Unit Tests Correct Answer - Testing small parts of a program
in an isolated manner to ensure they work as expected.