Alphabet question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Alphabet question

How would I go about writing a code that asks for an input of a lowercase letter, then have the code print that letter and the rest of the alphabet starting with the variable letter? e.g. Enter a lowercase letter: (t) t u v w x y z Program Finished.

29th Sep 2019, 2:22 PM
Advanced Incognizant
5 Answers
+ 1
myletter = input("Type in a letter") for x in range(ord(myletter), 123): print(chr(x)) # or use for x in range(ord(input("Type in a letter")), 123): print(chr(x))
29th Sep 2019, 3:15 PM
rodwynnejones
rodwynnejones - avatar
+ 1
~ swim ~ I understand that you are trying to make me think about this problem, its an efficient way for me to learn this way rather than just see the code made for me. Unfortunently i dont understand how the code above works so im still going to attempt my own variation with simpler things like if statements and while loops if thats possible :)
29th Sep 2019, 3:22 PM
Advanced Incognizant
+ 1
Nathen Hong- To supplement sololearn, try https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ Most of what i know (and i till class myself as a beginner) I've learnt from these two sites.
29th Sep 2019, 3:33 PM
rodwynnejones
rodwynnejones - avatar
0
~ swim ~ Thanks for your input, but as Im very new to python i dont really know how i would begin a question like this, so far i have letter = str(input(‘Enter a lowercase letter’). I am unsure how to compare values of letters and how to print select strings depending on a variable.
29th Sep 2019, 2:52 PM
Advanced Incognizant
0
~ swim ~ 6/13 on Control Structures
29th Sep 2019, 2:58 PM
Advanced Incognizant