2026fa_cse160/lecture20261103/for01/for06.py

14 lines
362 B
Python

# https://www.programiz.com/python-programming/for-loop
scores = [70, 91, 85, 90, 100,67.3]
#scores = [100,100,100,100, 100]
print(f"The length of this list of scores is {len(scores)}")
scoreSum = 0
for i in scores:
print(i)
scoreSum += i
else:
print("The average is ",scoreSum/len(scores))
print(f"The average is {scoreSum/len(scores):.1f}")