i
D335/ WGU D335: INTRODUCTION TO i i i i i
PROGRAMMING IN PYTHON NEWEST 2026 i i i i i
ACTUAL EXAM QUESTIONS AND CORRECT i i i i i
ANSWERS
i
i
22.1 Lab: Convert to Seconds
i i i i i
i
Write a program that reads in hours, minutes, and seconds as input,
i i i i i i i i i i i i
and outputs the time in seconds only.
i i i i i i i
i
22.2 Lab: Convert from Seconds
i i i i i
i
People find it easier to read time in hours, minutes, and seconds
i i i i i i i i i i i i
rather than just seconds.
i i i i
Write a program that reads in seconds as input and outputs the time
i i i i i i i i i i i i i
in hours, minutes, and seconds.
i i i i i
i
22.3 Lab: Pizza Party
i i i i
i
, Pagei 2i ofi 5i
i
Given the number of people attending a pizza party, output the
i i i i i i i i i i i
number of needed pizzas and total cost. For the calculation,
i i i i i i i i i i
assume that people eat 2 slices on average and each pizza has 12
i i i i i i i i i i i i i
slices and costs $14.95.i i i i
i
22.4 Lab: Hypotenuse
i i i
i
Given two numbers that represent the lengths of a right triangle's
i i i i i i i i i i i
legs (sides adjacent to the right angle), output the length of the third
i i i i i i i i i i i i i
side (i.e. hypotenuse) with two digits after the decimal point.
i i i i i i i i i i
i
22.5 Lab: Area of a Triangle
i i i i i i
i
Using Heron's formula, you can calculate the area of a triangle if you
i i i i i i i i i i i i i
know the lengths of all three sides. Given the length of each side of a
i i i i i i i i i i i i i i i
triangle as input, calculate the area of the triangle using Heron's
i i i i i i i i i i i
formula as follows: i i i
s = half of the triangle's perimeter area = the square root of s(s-
i i i i i i i i i i i i i
a)(s-b)(s-c), where a, b, and c are each sides of the triangle. i i i i i i i i i i i i