0
Pls does range only work for numbers?
6 Respostas
+ 5
What else would you want it to be a range of? If for alphabet, you can use a combination of range and chr()/ord().
ord('A') is 65
ord('Z') is 90
ord('a') is 97
ord('z') is 122
So try:
for i in range(65, 91):
print(chr(i), end='')
+ 3
In my view, range works for integers (whole numbers)
+ 1
range return a range of numbers, you can choose its end, start and step
https://code.sololearn.com/cZtmsnMaT9Uq/?ref=app
+ 1
The range() can generate integer values (which can be -ve number or +be number). It does not generate floating point values.
The below codes are all correct
range (-10,0)
range (0,10)
0
Range can only generate a set of integer numbers from a given band. Neither does it allow a float type parameter nor it can produce a float range of numbers.