I have looked on several websites, books, and in the documentation and I can't figure out what I am doing wrong. I try to ask for help as a last resort, so that I can learn on my own, but I have spent far too long trying to figure this out, and I am sure it is something really simple that I am doing wrong, but I am learning. The code produces a single different result every time it is ran. The code produces the following error: 26.8 Traceback (most recent call last): File "main.py", line 7, in tot = sum(rand)/len(rand) TypeError: 'float' object is not iterable
import random
for x in range (10000):
rand = random.uniform(10, 100)
print(round(rand, 1))
tot = sum(rand)/len(rand)
print (round(tot, 1))
Aucun commentaire:
Enregistrer un commentaire