Introduction to Programming in Python WGU D335
Exam TESTBANK ALL QUESTIONS AND CORRECT
ANSWERS LATEST UPDATE THIS YEAR
WGU D335: Introduction to Programming in Python
EXAM TESTBANK – ALL QUESTIONS AND CORRECT ANSWERS
LATEST UPDATE THIS YEAR
Course: D335 – Introduction to Programming in Python
Exam Type: Actual Exam–Style Practice
Edition: Latest Update This Year
Content: Complete Questions with Verified Python Solutions
EXAMINATION INSTRUCTIONS
This exam evaluates Python fundamentals including:
• Input/output
• Data types
• Arithmetic operations
• Lists and dictionaries
• Conditional logic
• Loops
• File handling
• Exception handling
1
, Page 2 of 43
• Module usage
Each question requires a fully functional Python solution.
Outputs must match the required format exactly.
EXAM QUESTIONS
Question 1 – Employee Commute Distance
Create a solution that accepts three integer inputs representing how many times each
employee travels to a job site.
Calculate and output the total distance traveled, formatted to two decimal places.
Commute distances:
• Employee A: 15.62 miles
• Employee B: 41.85 miles
• Employee C: 32.67 miles
Output format:
Distance: total_miles_traveled miles
✅ ANSWER
travels = {
"A": int(input()),
2
, Page 3 of 43
"B": int(input()),
"C": int(input())
}
miles_per_employee = {"A": 15.62, "B": 41.85, "C": 32.67}
total_miles_traveled = sum(
travels[e] * miles_per_employee[e] for e in travels
)
print(f"Distance: {total_miles_traveled:.2f} miles")
Question 2 – Ounces Conversion
Accept an integer representing ounces and convert to tons, pounds, and ounces.
Conversions:
• 16 ounces = 1 pound
3
, Page 4 of 43
• 2000 pounds = 1 ton
Output format:
Tons: X Pounds: Y Ounces: Z
✅ ANSWER
ounces = int(input())
tons = ounces // (16 * 2000)
pounds = (ounces % (16 * 2000)) // 16
remaining_ounces = ounces % 16
print(f"Tons: {tons}")
print(f"Pounds: {pounds}")
print(f"Ounces: {remaining_ounces}")
Question 3 – Data Type Identification
Given an index input, output the data type name of the element in the list.
4