for number in range(x, y)
every number
in that range represents a single int
you cannot take the min
of a single int
. However you could append all those values to your empty list number
and then take the min
of that list
, but even so we could just print the min
of the entire range(x, y)
number = []
for i in range(1,21):
number.append(i)
print(min(number)) # => 1
Or just using the range
itself:
print(min(range(1, 12))) # => 1
2
solved Printing the minimum value out of a list (PYTHON) [duplicate]