Docsity

D335 WGU Introduction to Programming in Python Practice Test, Exams of Nursing

Toggle sidebar
bg1
Confidenal
Page 1 of 13
D335/ WGU D335: INTRODUCTION TO
PROGRAMMING IN PYTHON HOME: PRACTICE TEST
2 NEWEST 2026 ACTUAL EXAM QUESTIONS AND
CORRECT DETAILED ANSWERS (VERIFIED
ANSWERS) ALL ANSWERED {15 Q & A} ALREADY
GRADED A+ | BRAND NEW! | 100% GUARANTEED
PASS | WGU
Create a solution that accepts three integer inputs representing
the number of times an employee travels to a job site. Output the
total distance traveled to two decimal places given the following
miles per employee commute to the job site. Output the total
distance traveled to two decimal places given the following miles
per employee commute to the job site:
Employee A: 15.62 miles
Employee B: 41.85 miles
Employee C: 32.67 miles
The solution output should be in the format
Distance: total_miles_traveled miles - ✔✔✔ Correct Answer > travels =
{
"A": int(input()),
"B": int(input()),
"C": int(input())
1 / 13
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download D335 WGU Introduction to Programming in Python Practice Test and more Exams Nursing in PDF only on Docsity!

ConfidenƟal

D335/ WGU D335: INTRODUCTION TO

PROGRAMMING IN PYTHON HOME: PRACTICE TEST

2 NEWEST 2026 ACTUAL EXAM QUESTIONS AND

CORRECT DETAILED ANSWERS (VERIFIED

ANSWERS) ALL ANSWERED { 15 Q & A} ALREADY

GRADED A+ | BRAND NEW! | 100% GUARANTEED

PASS | WGU

Create a solution that accepts three integer inputs representing the number of times an employee travels to a job site. Output the total distance traveled to two decimal places given the following miles per employee commute to the job site. Output the total distance traveled to two decimal places given the following miles per employee commute to the job site: Employee A: 15.62 miles Employee B: 41.85 miles Employee C: 32.67 miles The solution output should be in the format Distance: total_miles_traveled miles - ✔✔✔ Correct Answer > travels = { "A": int(input()), "B": int(input()), "C": int(input())

ConfidenƟal

miles_per_employee = {"A": 15.62, "B":41.85, "C": 32.67} total_miles_traveled = sum(travels[employee] * miles_per_employee[employee] for employee in travels) print(f"Distance: {total_miles_traveled:.2f} miles") Create a solution that accepts an integer input representing any number of ounces. Output the converted total number of tons, pounds, and remaining ounces based on the input ounces value. There are 16 ounces in a pound and 2,000 pounds in a ton. The solution output should be in the format Tons: value_1 Pounds: value_2 Ounces: value_3 - ✔✔✔ Correct Answer > ounces = int(input()) value_1 = ounces // (16 * 2000) value_2 = (ounces % (16 * 2000)) // 16 value_3 = ounces % 16 print(f"Tons: {value_1}") print(f"Pounds: {value_2}") print(f"Ounces: {value_3}") Create a solution that accepts an integer input representing the index value for any any of the five elements in the following list:

ConfidenƟal

print(f"Trapezoid area: {area_value} square meters") Create a solution that accepts five integer inputs. Output the sum of the five inputs three times, converting the inputs to the requested data type prior to finding the sum. First output: sum of five inputs maintained as integer values Second output: sum of five inputs converted to float values Third output: sum of five inputs converted to string values (concatenate) The solution output should be in the format Integer: integer_sum_value Float: float_sum_value String: string_sum_value - ✔✔✔ Correct Answer > num1 = int(input()) num2 = int(input()) num3 = int(input()) num4 = int(input()) num5 = int(input()) integer_sum_value = num1 + num2 + num3 + num4 + num float_sum_value = float(num1) + float(num2) + float(num3) + float(num4) + float(num5) string_sum_value = str(num1) + str(num2) + str(num3) + str(num4) + str(num5) print(f"Integer: {integer_sum_value}") print(f"Float: {float_sum_value}")

ConfidenƟal

print(f"String: {string_sum_value}") Create a solution that accepts an integer input representing a 9- digit unformatted student identification number. Output the identification number as a string with no spaces. The solution output should be in the format 111 - 22 - 3333 - ✔✔✔ Correct Answer > student_id = int(input()) student_id >= 100000000 and student_id <= 999999999 part1 = student_id // 1000000 part2 = (student_id // 10000) % 100 part3 = student_id % 10000 formatted_id = f"{part1}-{part2}-{part3}" print(formatted_id) Create a solution that accepts an integer input to compare against the following list: predef_list = [4, - 27, 15, 33, - 10] Output a Boolean value indicating whether the input value is greater than the maximum value from predef_list The solution output should be in the format Greater Than Max? Boolean_value - ✔✔✔ Correct Answer > num = int(input()) boolean_value = False

ConfidenƟal

Create a solution that accepts an integer input representing water temperature in degrees Fahrenheit. Output a description of the water state based on the following scale: If the temperature is below 33° F, the water is "Frozen". If the water is between 33° F and 80° F (including 33), the water is "Cold". If the water is between 80° F and 115° F (including 80), the water is "Warm". If the water is between 115° F and 211° (including 115) F, the water is "Hot". If the water is greater than or equal to 212° F, the water is "Boiling". Additionally, output a safety comment only during the following circumstances: If the water is exactly 212° F, the safety comment is "Caution: Hot!" If the water temperature is less than 33° F, the safety comment is "Watch out for ice!" The solution output should be in the format water_state optional_safety_comment - ✔✔✔ Correct Answer > temperature = int(input()) water_state = "" optional_safety_comment = ""

ConfidenƟal

if temperature < 33: water_state = "Frozen" optional_safety_comment = "Watch out for ice!" elif 33 <= temperature < 80: water_state = "Cold" elif 80 <= temperature < 115: water_state = "Warm" elif 115 <= temperature < 212: water_state = "Hot" elif temperature >= 212: water_state = "Boiling" if temperature == 212: optional_safety_comment = "Caution: Hot!" print(water_state) if optional_safety_comment: print(optional_safety_comment) Create a solution that accepts an integer input identifying how many shares of stock are to be purchased from the Old Town Stock Exchange, followed by an equivalent number of string inputs representing the stock selections. The following dictionary stock lists available stock selections as the key with the cost per selection as the value.

ConfidenƟal

If between ten and twenty items (inclusive) are purchased, the purchase gets a 5% discount. If twenty-one or more items are purchased, the purchase gets a 10% discount. Output the chosen item and total cost of the purchase to two decimal places. The solution output should be in the format item_purchased $total_purchase_cost - ✔✔✔ Correct Answer > item_purchased = input().lower() num_items = int(input()) if item_purchased in purchase: total_purchase_cost = purchase[item_purchased]* num_items if 10 <= num_items <= 20: total_purchase_cost = total_purchase_cost - (total_purchase_cost.05) elif num_items >= 21: total_purchase_cost = total_purchase_cost - (total_purchase_cost.10) print(f"{item_purchased} ${total_purchase_cost:.2f}")

ConfidenƟal

Create a solution that accepts an input identifying the name of a text file, for example, "WordTextFile1.txt". Each text file contains three rows with one word per row. Using the open() function and write() and read() methods, interact with the input text file to write a new sentence string composed of the three existing words to the end of the file contents on a new line. Output the new file contents. The solution output should be in the format word1 word2 word3 sentence - ✔✔✔ Correct Answer > file_name = input() with open(file_name, 'r') as f: word1 = f.readline().strip() word2 = f.readline().strip() word3 = f.readline().strip() sentence = f"{word1} {word2} {word3}" with open(file_name, 'a') as f: f.write(f"\n{sentence}") with open(file_name, 'r') as f: lines = f.read().strip() print(lines) Create a solution that accepts an input identifying the name of a CSV file, for example, "input1.csv". Each file contains two rows of comma-separated values. Import the built-in module csv and

ConfidenƟal

factorial_value = math.factorial(num) print(factorial_value) if factorial_value > 100: Boolean_value = True print(Boolean_value) else: Boolean_value = False print(Boolean_value) Create a solution that accepts an integer input representing the age of a pig. Import the existing module pigAge and use its pre- built pigAge_converter() function to calculate the human equivalent age of a pig. A year in a pig's life is equivalent to five years in a human's life. Output the human-equivalent age of the pig. The solution output should be in the format input_pig_age is converted_pig_age in human years - ✔✔✔ Correct Answer > import pigAge input_pig_age = int(input()) converted_pig_age = pigAge.pigAge_converter(input_pig_age) print(f"{input_pig_age} is {converted_pig_age} in human years")