Python list range | Sololearn: Learn to code for FREE!

+1

Python list range

print(list(range(100))) #will print list 0 - 99 is there a function that similar with range but can print a - z? just asking

8/13/2017 11:41:05 AM

Kevin AS

2 Answers

New Answer

+5

well, it depends how technical you wanna get: import string string.ascii_lowercase string.ascii_uppercase string.ascii_letters (contains both upper and lower) This imports the alphabet itself from ascii. There is an upper/lower/both versions. You can use it as so: for letter in string.ascii_lowercase: print (letter) or you can put it in a list of you really need to: list (string.ascii_lowercase) There is also a third option: letters = "abcdefghijklmnopqrstuvwxyz" for each in letters: print (each)

0

interesting. i will try import string.thanx