How can I print the alphabet on one line using chr(), with each letter seperated by a space.
My current code:
for x in range(97,123):
letter = chr(x)
alphabet = "" + letter
print alphabet
How can I print the alphabet on one line using chr(), with each letter seperated by a space.
My current code:
for x in range(97,123):
letter = chr(x)
alphabet = "" + letter
print alphabet
import string
print " ".join(string.lowercase)
Or if the use of chr
is mandatory, as mentioned in the comments:
print " ".join([chr(c) for c in xrange(ord('a'), ord('z') + 1)])