WGU D335 INTRODUCTION TO PROGRAMMING IN PYTHON OBJECTIVE ASSESSMENT ACTUAL EXAM 2026, Exams of Programming Languages

WGU D335 INTRODUCTION TO PROGRAMMING IN PYTHON OBJECTIVE ASSESSMENT ACTUAL EXAM QUESTIONS WITH CORRECT ANSWERS LATEST UPDATE 2026

Typology: Exams

2025/2026

Available from 03/13/2026

Karegi
Karegi 🇺🇸

2.6K documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
P a g e | 1
WGU D335 INTRODUCTION TO
PROGRAMMING IN PYTHON
OBJECTIVE ASSESSMENT ACTUAL
EXAM QUESTIONS WITH CORRECT
ANSWERS LATEST UPDATE 2026
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())
}
miles_per_employee = {"A": 15.62, "B":41.85, "C": 32.67}
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download WGU D335 INTRODUCTION TO PROGRAMMING IN PYTHON OBJECTIVE ASSESSMENT ACTUAL EXAM 2026 and more Exams Programming Languages in PDF only on Docsity!

WGU D335 INTRODUCTION TO

PROGRAMMING IN PYTHON

OBJECTIVE ASSESSMENT ACTUAL

EXAM QUESTIONS WITH CORRECT

ANSWERS LATEST UPDATE 2026

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()) } 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: various_data_types = [516, 112.49, True, "meow", ("Western", "Governors", "University"), {"apple": 1, "pear": 5}]

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}") 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 <= 999999 999 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 max_value = max(predef_list) if num > max_value:

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 = "" 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. stocks = {'TSLA': 912.86 , 'BBBY': 24.84, 'AAPL': 174.26, 'SOFI': 6.92, 'KIRK': 8.72, 'AURA': 22.12, 'AMZN': 141.28, 'EMBK': 12.29, 'LVLU': 2.33}

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}") 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 use its open() function and reader() method to create a dictionary of key:value pairs for each row of comma-separated values in the specified file. Output the file contents as two dictionaries. The solution output should be in the format {'key': 'value', 'key': 'value', 'key': 'value'} {'key': 'value', 'key': 'value', 'key': 'value'} - correct answer-import csv

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")