Python Forum

Full Version: Simple statistics with range function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am sure this is easy for you guys, i am new here.

I try to use a range function and then get some simple statistics out of this (min,max,sum). I get the list but get an error for the min number.

Thanks.

for numbers in range(21):
  print(numbers)
print(min(numbers)) 
The for loop variable (numbers in this case) gets one value from the range generator each time through the loop. So at the end of the loop, numbers is equal to 21. You can't take the min of one number, you need to either supply a sequence or multiple arguments.
Thanks a lot !!!