0

Pls does range only work for numbers?

18th Jun 2020, 4:22 PM
Ayomide Ademuyiwa
Ayomide Ademuyiwa - avatar
6 Réponses
+ 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='')
18th Jun 2020, 4:52 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
In my view, range works for integers (whole numbers)
18th Jun 2020, 4:27 PM
Reuben Akwasi Aboagye
Reuben Akwasi Aboagye - avatar
+ 1
range return a range of numbers, you can choose its end, start and step https://code.sololearn.com/cZtmsnMaT9Uq/?ref=app
18th Jun 2020, 4:37 PM
Sousou
Sousou - avatar
+ 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)
18th Jun 2020, 4:56 PM
MILES CODER
MILES CODER - avatar
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.
18th Jun 2020, 4:37 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar