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
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.