D335 Introduction to Python PA Questions and Answers Study Guide, Exams of Programming Languages

This WGU D335 Introduction to Python study resource provides a structured collection of Performance Assessment (PA) questions and verified answers designed to support effective preparation. It covers key Python programming concepts such as variables, data types, loops, functions, conditionals, lists, dictionaries, file handling, and debugging techniques. Designed for students learning foundational programming skills, this material simplifies coding concepts and reinforces problem-solving abilities through practical examples. The organized question-and-answer format improves understanding, enhances retention, and builds confidence, making it a valuable tool for mastering Python fundamentals and achieving success in the D335 assessment.

Typology: Exams

2025/2026

Available from 05/07/2026

hose-pass
hose-pass ๐Ÿ‡บ๐Ÿ‡ธ

694 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
D335 Intro uction to Python (PA) ๐‘‘
Answers (for questions 1-15):
#1:
times_travele A = int(input())๐‘‘
times_travele B = int(input())๐‘‘
times_travele C = int(input())๐‘‘
EmployeeA = 15.62 #miles
EmployeeB = 41.85 #miles
EmployeeC = 32.67 #miles
istance_travele A = EmployeeA * times_travele A๐‘‘ ๐‘‘ ๐‘‘
istance_travele B = EmployeeB * times_travele B๐‘‘ ๐‘‘ ๐‘‘
istance_travele C = EmployeeC * times_travele C๐‘‘ ๐‘‘ ๐‘‘
total_ istance_travele = istance_travele A + istance_travele B + istance_travele C๐‘‘ ๐‘‘ ๐‘‘ ๐‘‘ ๐‘‘ ๐‘‘ ๐‘‘ ๐‘‘
print("Distance: {:.2f} miles".format(total_ istance_travele ))๐‘‘ ๐‘‘
#2:
ounces_per_poun = 16๐‘‘
poun s_per_ton = 2000๐‘‘
num_ounces = int(input())
tons = num_ounces // (ounces_per_poun * poun s_per_ton)๐‘‘ ๐‘‘
remaining_ounces = num_ounces % (ounces_per_poun * poun s_per_ton) ๐‘‘ ๐‘‘
poun s = remaining_ounces // ounces_per_poun๐‘‘ ๐‘‘
remaining_ounces = remaining_ounces % ounces_per_poun๐‘‘
print("Tons: {}".format(tons))
print("Poun s: {}".format(poun s))๐‘‘ ๐‘‘
print("Ounces: {}".format(remaining_ounces))
#3:
in ex_value = int(input())๐‘‘
name = various_ ata_types[in ex_value]๐‘‘ ๐‘‘
ata_type = type(name).__name__๐‘‘
print(f"Element {in ex_value}: ๐‘‘
{ ata_type}")๐‘‘
#4:
b1 = int(input())
b2 = int(input())
h = int(input())
area_value = ((b1 + b2) / 2) * h
print("Trapezoi area: {:.1f} square meters".format(area_value))๐‘‘
pf3
pf4
pf5

Partial preview of the text

Download D335 Introduction to Python PA Questions and Answers Study Guide and more Exams Programming Languages in PDF only on Docsity!

D335 Intro ๐‘‘uction to Python (PA)

Answers (for questions 1-15):

times_travele ๐‘‘A = int(input()) times_travele ๐‘‘B = int(input()) times_travele ๐‘‘C = int(input()) EmployeeA = 15.62 #miles EmployeeB = 41.85 #miles EmployeeC = 32.67 #miles ๐‘‘ istance_travele ๐‘‘A = EmployeeA * times_travele ๐‘‘A ๐‘‘ istance_travele ๐‘‘B = EmployeeB * times_travele ๐‘‘B ๐‘‘ istance_travele ๐‘‘C = EmployeeC * times_travele ๐‘‘C total_ ๐‘‘istance_travele ๐‘‘ = ๐‘‘istance_travele ๐‘‘A + ๐‘‘istance_travele ๐‘‘B + ๐‘‘istance_travele ๐‘‘C print("Distance: {:.2f} miles".format(total_ ๐‘‘istance_travele ๐‘‘)) #2: ounces_per_poun ๐‘‘= 16 poun ๐‘‘s_per_ton = 2000 num_ounces = int(input()) tons = num_ounces // (ounces_per_poun ๐‘‘ * poun ๐‘‘s_per_ton) remaining_ounces = num_ounces % (ounces_per_poun ๐‘‘ * poun ๐‘‘s_per_ton) poun ๐‘‘s = remaining_ounces // ounces_per_poun ๐‘‘ remaining_ounces = remaining_ounces % ounces_per_poun๐‘‘ print("Tons: {}".format(tons)) print("Poun ๐‘‘s: {}".format(poun ๐‘‘s)) print("Ounces: {}".format(remaining_ounces)) #3: in ๐‘‘ex_value = int(input()) name = various_ ๐‘‘ata_types[in ๐‘‘ex_value] ๐‘‘ ata_type = type(name).name print(f"Element {in ๐‘‘ex_value}: { ๐‘‘ata_type}") #4: b1 = int(input()) b2 = int(input()) h = int(input()) area_value = ((b1 + b2) / 2) * h print("Trapezoi ๐‘‘area: {:.1f} square meters".format(area_value))

num1 = int(input()) num2 = int(input()) num3 = int(input()) num4 = int(input()) num5 = int(input()) integer_sum = num1 + num2 + num3 + num4 + num float_sum = float(num1) + float(num2) + float(num3) + float(num4) + float(num5) string_sum = str(num1) + str(num2) + str(num3) + str(num4) + str(num5) print("Integer: {}".format(integer_sum)) print("Float: {}".format(float_sum)) print("String: {}".format(string_sum)) #6: stu ๐‘‘ent_i ๐‘‘= int(input()) stu ๐‘‘ent_i ๐‘‘_string = str(stu ๐‘‘ent_i ๐‘‘) first3 = stu ๐‘‘ent_i ๐‘‘_string[0:3] secon ๐‘‘2 = stu ๐‘‘ent_i ๐‘‘_string[3:5] last4 = stu ๐‘‘ent_i ๐‘‘_string[5:] print(f"{first3}-{secon ๐‘‘2}-{last4}") #7: pre ๐‘‘ef_list = [4, -27, 15, 33, -10] boolean_value = False max_value = max(pre ๐‘‘ef_list) num = int(input()) if num > max_value: boolean_value = True print("Greater Than Max? {}".format(boolean_value)) else: print("Greater Than Max? {}".format(boolean_value)) #8: temperature = int(input()) if temperature >= 212: print("Boiling") if temperature == 212: print("Caution: Hot!") if temperature in range(115, 212): #115- print("Hot") if temperature in range(80, 115): #80- print("Warm") if temperature in range(33, 80): #33- print("Col ๐‘‘") if temperature < 33:

print(store_item, "${:.2f}".format(total_cost)) if num_items >= 21: ๐‘‘ iscount = total_cost * 0. total_cost = total_cost - ๐‘‘iscount print(store_item, "${:.2f}".format(total_cost)) #12: ๐‘‘ ef wor ๐‘‘s_in_file(file): with open(file, "r") as f: wor ๐‘‘s = [wor ๐‘‘.rstrip() for wor ๐‘‘ in f.rea ๐‘‘lines()] sentence = " ".join(wor ๐‘‘s) with open(file, "a") as f: f.write("\n" + sentence) with open(file, "r") as f: print(f.rea ๐‘‘()) file = input() wor ๐‘‘s_in_file(file) #13: import csv input1 = input() with open(input1, "r") as f: ๐‘‘ ata = [row for row in csv.rea ๐‘‘er(f)] for row in ๐‘‘ata: even = [row[i].strip() for i in range(0, len(row), 2)] o ๐‘‘๐‘‘= [row[i].strip() for i in range(1, len(row), 2)] pair = ๐‘‘ict(zip(even, o ๐‘‘๐‘‘)) print(pair) #14: import math num = int(input()) boolean_value = False factorial_value = math.factorial(num) if factorial_value > 100: boolean_value = True print(factorial_value) print(boolean_value) else:

print(factorial_value) print(boolean_value) #15: import pigAge ๐‘‘ ef pigAge_converter(pigs_age): return pigs_age * 5 pigs_age = int(input()) converte ๐‘‘_pigs_age = pigAge_converter(pigs_age) print(f"{pigs_age} is {converte ๐‘‘_pigs_age} in human years")