Code in Python Programming Language Finish the program below by adding code to d
ID: 3904240 • Letter: C
Question
Code in Python Programming Language
Finish the program below by adding code to do the following: 1. Show each element (number) in the list 'wz' on a separate line (one value 2. Show as output each element (number) in the list 'wz' that has a value 3. Show a sentence identifying the average of all the numbers in the list wz' per line). greater than or equal to 12. that are less than 40. Do not include the larger numbers in the average. (Example: If the list contained [56, 6, 74, 2] -Part 1 would write all 4 numbers with each number on a separate line. Part 2 would write 54, 74; and Part 3 would write a sentence showing 'average - 4'. The program must work with any number the user enters) WZ- num - int(input('Enter a number (0 to finish): )) while num! 0: wz.append(num) num - int(input(Enter another number(0 to finish):')) print0 # ADD your code hereExplanation / Answer
wz = [] num = int(input('Enter a number(0 to finish): ')) while num != 0: wz.append(num) num = int(input('Enter a number(0 to finish): ')) print() # 1 for num in wz: print(num) # 2 for num in wz: if num >= 12: print(num) # 3 total = 0 count = 0 for num in wz: if num < 40: total += num count += 1 print('Average is ' + str(total / count))Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.