0

how to\loop alphabet

For a couple of days i've tried to make a while loop with the alphabet (from A to Z). Couldn't find a way. So before i forget about it, I want to know if anyone out there did it. Is it even possible ? I know there is value for each letter from in the alphabet. Show me the way please. TY

3rd Jul 2019, 2:39 AM
snake
snake - avatar
3 odpowiedzi
+ 4
Here's the solution for Java: for(char i='a'; i<='z'; i++) System.out.print(i+" "); or if you want to do it with while loop: char i= 'a' ; while(i<='z'){ System.out.print(i+" ") ; i++; }
3rd Jul 2019, 2:46 AM
voja
voja - avatar
+ 1
#Python for letter in range(ord('A'), ord('Z')+1): print(chr(letter)) #with while loop letter = 'A' while letter <= 'Z': print(letter) letter = chr(ord(letter) + 1)
3rd Jul 2019, 6:29 AM
Tibor Santa
Tibor Santa - avatar
0
Thanks for your answer. I should've precised that I'm learning python now and don't know the other languages yet. At least I'll have the code for java when I'll learn it. Thanks again voja!
3rd Jul 2019, 3:01 AM
snake
snake - avatar