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

PROF.GUIDE
PROF.GUIDE ๐Ÿ‡ท๐Ÿ‡ด

5

(1)

1.4K documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
D335 Introduction to Python (PA)
Answers (for questions 1-15):
#1:
times_tr veledA = int(input())๐‘Ž
times_tr veledB = int(input())๐‘Ž
times_tr veledC = int(input())๐‘Ž
EmployeeA = 15.62 #miles
EmployeeB = 41.85 #miles
EmployeeC = 32.67 #miles
dist nce_tr veledA = EmployeeA * times_tr veledA๐‘Ž ๐‘Ž ๐‘Ž
dist nce_tr veledB = EmployeeB * times_tr veledB๐‘Ž ๐‘Ž ๐‘Ž
dist nce_tr veledC = EmployeeC * times_tr veledC๐‘Ž ๐‘Ž ๐‘Ž
tot l_dist nce_tr veled = dist nce_tr veledA + dist nce_tr veledB + dist nce_tr veledC๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
print("Dist nce: {:.2f} miles".form t(tot l_dist nce_tr veled))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
#2:
ounces_per_pound = 16
pounds_per_ton = 2000
num_ounces = int(input())
tons = num_ounces // (ounces_per_pound * pounds_per_ton)
rem ining_ounces = num_ounces % (ounces_per_pound * pounds_per_ton) ๐‘Ž
pounds = rem ining_ounces // ounces_per_pound๐‘Ž
rem ining_ounces = rem ining_ounces % ounces_per_pound๐‘Ž ๐‘Ž
print("Tons: {}".form t(tons))๐‘Ž
print("Pounds: {}".form t(pounds))๐‘Ž
print("Ounces: {}".form t(rem ining_ounces))๐‘Ž ๐‘Ž
#3:
index_v lue = int(input())๐‘Ž
n me = v rious_d t _types[index_v lue]๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
d t _type = type(n me).__n me__๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
print(f"Element {index_v lue}: ๐‘Ž
{d t _type}")๐‘Ž ๐‘Ž
#4:
b1 = int(input())
b2 = int(input())
h = int(input())
re _v lue = ((b1 + b2) / 2) * h๐‘Ž ๐‘Ž ๐‘Ž
print("Tr pezoid re : {:.1f} squ re ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
meters".form t( re _v lue))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž
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 Introduction to Python (PA)

Answers (for questions 1-15):

times_tr veledA = int(input())๐‘Ž times_tr veledB = int(input())๐‘Ž times_tr veledC = int(input())๐‘Ž EmployeeA = 15.62 #miles EmployeeB = 41.85 #miles EmployeeC = 32.67 #miles dist nce_tr veledA = EmployeeA * times_tr veledA๐‘Ž ๐‘Ž ๐‘Ž dist nce_tr veledB = EmployeeB * times_tr veledB๐‘Ž ๐‘Ž ๐‘Ž dist nce_tr veledC = EmployeeC * times_tr veledC๐‘Ž ๐‘Ž ๐‘Ž tot l_dist nce_tr veled = dist nce_tr veledA + dist nce_tr veledB + dist nce_tr veledC๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž print("Dist nce: {:.2f} miles".form t(tot l_dist nce_tr veled))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž #2: ounces_per_pound = 16 pounds_per_ton = 2000 num_ounces = int(input()) tons = num_ounces // (ounces_per_pound * pounds_per_ton) rem ining_ounces = num_ounces % (ounces_per_pound * pounds_per_ton)๐‘Ž pounds = rem ining_ounces // ounces_per_pound๐‘Ž rem ining_ounces = rem ining_ounces % ounces_per_pound๐‘Ž ๐‘Ž print("Tons: {}".form t(tons))๐‘Ž print("Pounds: {}".form t(pounds))๐‘Ž print("Ounces: {}".form t(rem ining_ounces))๐‘Ž ๐‘Ž #3: index_v lue = int(input())๐‘Ž n me = v rious_d t _types[index_v lue]๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž d t _type = type(n me).n me๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž print(f"Element {index_v lue}:๐‘Ž {d t _type}")๐‘Ž ๐‘Ž #4: b1 = int(input()) b2 = int(input()) h = int(input()) ๐‘Ž re _v lue = ((b1 + b2) / 2) * h ๐‘Ž ๐‘Ž print("Tr pezoid๐‘Ž ๐‘Žre : {:.1f} squ re ๐‘Ž ๐‘Ž meters".form t( re _v lue))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž

num1 = int(input()) num2 = int(input()) num3 = int(input()) num4 = int(input()) num5 = int(input()) integer_sum = num1 + num2 + num3 + num4 + num flo t_sum = flo t(num1) + flo t(num2) + flo t(num3) + flo t(num4) + flo t(num5)๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž string_sum = str(num1) + str(num2) + str(num3) + str(num4) + str(num5) print("Integer: {}".form t(integer_sum))๐‘Ž print("Flo t: {}".form t(flo t_sum))๐‘Ž ๐‘Ž ๐‘Ž print("String: {}".form t(string_sum))๐‘Ž #6: student_id = int(input()) student_id_string = str(student_id) first3 = student_id_string[0:3] second2 = student_id_string[3:5] l st4 = student_id_string[5:]๐‘Ž print(f"{first3}-{second2}-{l st4}")๐‘Ž #7: predef_list = [4, -27, 15, 33, -10] boole n_v lue = F lse๐‘Ž ๐‘Ž ๐‘Ž m x_v lue = m x(predef_list)๐‘Ž ๐‘Ž ๐‘Ž num = int(input()) if num > m x_v lue:๐‘Ž ๐‘Ž boole n_v lue = True๐‘Ž ๐‘Ž print("Gre ter Th n M x? {}".form t(boole n_v lue))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž else: print("Gre ter Th n M x? {}".form t(boole n_v lue))๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž #8: temper ture = int(input())๐‘Ž if temper ture >= 212:๐‘Ž print("Boiling") if temper ture == 212:๐‘Ž print("C ution: Hot!")๐‘Ž if temper ture in r nge(115, 212): #115-211๐‘Ž ๐‘Ž print("Hot") if temper ture in r nge(80, 115): #80-114๐‘Ž ๐‘Ž print("W rm")๐‘Ž if temper ture in r nge(33, 80): #33-79๐‘Ž ๐‘Ž print("Cold") if temper ture < 33:๐‘Ž

print(store_item, "${:.2f}".form t(tot l_cost))๐‘Ž ๐‘Ž if num_items >= 21: discount = tot l_cost * 0.10๐‘Ž tot l_cost = tot l_cost - discount๐‘Ž ๐‘Ž print(store_item, "${:.2f}".form t(tot l_cost))๐‘Ž ๐‘Ž #12: def words_in_file(file): with open(file, "r") ๐‘Žs f: words = [word.rstrip() for word in f.re dlines()]๐‘Ž sentence = " ".join(words) with open(file, " ")๐‘Ž ๐‘Žs f: f.write("\n" + sentence) with open(file, "r") ๐‘Žs f: print(f.re d())๐‘Ž file = input() words_in_file(file) #13: import csv input1 = input() with open(input1, "r") ๐‘Žs f: d t๐‘Ž ๐‘Ž = [row for row in csv.re der(f)]๐‘Ž for row in d t :๐‘Ž ๐‘Ž even = [row[i].strip() for i in r nge(0, len(row), 2)]๐‘Ž odd = [row[i].strip() for i in r nge(1, len(row), 2)]๐‘Ž p ir = dict(zip(even, odd))๐‘Ž print(p ir)๐‘Ž #14: import m th๐‘Ž num = int(input()) boole n_v lue = F lse๐‘Ž ๐‘Ž ๐‘Ž f ctori l_v lue = m th.f ctori l(num)๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž ๐‘Ž if f ctori l_v lue > 100:๐‘Ž ๐‘Ž ๐‘Ž boole n_v lue = True๐‘Ž ๐‘Ž print(f ctori l_v lue)๐‘Ž ๐‘Ž ๐‘Ž print(boole n_v lue)๐‘Ž ๐‘Ž else:

print(f ctori l_v lue)๐‘Ž ๐‘Ž ๐‘Ž print(boole n_v lue)๐‘Ž ๐‘Ž #15: import pigAge def pigAge_converter(pigs_ ge):๐‘Ž return pigs_ ge * 5๐‘Ž pigs_ ge = int(input())๐‘Ž converted_pigs_ ge = pigAge_converter(pigs_ ge)๐‘Ž ๐‘Ž print(f"{pigs_ ge} is {converted_pigs_ ge} in hum n๐‘Ž ๐‘Ž ๐‘Ž ye rs")๐‘Ž