Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python I need this code to read through the list a and only print the numb

ID: 3788128 • Letter: U

Question

Using python I need this code to read through the list a and only print the number if it is equal to 4. Below is what i have so far but when i run it through python it only prints "4" on six seperate lines. Im not entirely sure if the code is reading the list or just printing "4" for each value.

a=[2,5,9,1,4,8]
wanted=a[5]
for num in a:
if num in a:
wanted = True
print (4)
else:
wanted = False
print(none)

additionally I need to use the same list a, sum up the values and then print out the average using a for loop. The average is to be a float.

Explanation / Answer

output:

4

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote