Can range function be used for characters/alphabets too in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can range function be used for characters/alphabets too in python?

11th Aug 2019, 6:52 AM
karangreat
7 Answers
+ 4
Not directly I suppose, but by obtaining the ASCII code of a character it might work. What triggered this question if I may ask? Example (runs in Playground) for c in range(ord('a'), ord('i')): print(chr(c))
11th Aug 2019, 7:08 AM
Ipang
11th Aug 2019, 7:09 AM
Dlite
Dlite - avatar
+ 3
https://www.sololearn.com/Discuss/1495591/?ref=app
11th Aug 2019, 7:25 AM
Louis
Louis - avatar
+ 2
Thank you. I have just started learning python and while learning about range function for numbers the question just came up in my mind.
11th Aug 2019, 7:16 AM
karangreat
+ 1
D'Lite That's right bro!
11th Aug 2019, 7:13 AM
Ipang
+ 1
that might not be possible in python
9th Sep 2019, 1:26 AM
Emmanuel
- 1
Ye topper 😏😏😏
15th Aug 2019, 11:13 AM
karangreat
karangreat - avatar