0

So I tried a = "a" while a <= "e": print(a) a = "a" + "1" print("Finished") and it said time limit exceeded

How do you do a while loop with letters?

7th Sep 2016, 10:49 PM
Tendai25
Tendai25 - avatar
5 Respostas
+ 3
a = "a" while a <= "e": print(a) a = chr(ord(a)+1) print("Finished")
7th Sep 2016, 11:18 PM
Zen
Zen - avatar
+ 2
ord() is to get the ascii code of the character chr() is to get the character corresponding to the ascii code
7th Sep 2016, 11:28 PM
Zen
Zen - avatar
+ 1
simply ur second line is not inside the while loop...
10th Sep 2016, 8:16 PM
Sahil Kumar
Sahil Kumar - avatar
0
I don't get the chord thing
7th Sep 2016, 11:21 PM
Tendai25
Tendai25 - avatar
0
ok thanks
7th Sep 2016, 11:29 PM
Tendai25
Tendai25 - avatar