



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 5
This page cannot be seen from the preview
Don't miss anything!




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