



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