+ 2
URGENT: How do I count up in letters?
Just like you can use for each in range(1, 100): print(each) can you do this for letters? This is without using hundreds of if elif statements and can be easily expanded If you know how to get it to count a-z please let me know, but if you can make it a-zz I would love to know (with y, z, aa, ab etc) Thanks
4 odpowiedzi
+ 2
print("Printing a-z")
for i in range (97,123): print (chr(i))
print("Printing the combination of two character")
for I in range (97,123):
for j in range (97,123):
print(chr(i)+chr(j))
+ 1
Try this:
start = ord('a')
end = ord('z') + 1
for i in range(start, end):
for j in range(start, end):
print (chr(i) + chr(j))
0
Use Len(string) to get the count of letters in a string. not sure if you were asking the same.
- 3
a b c d e f g h i j k l m n o p q r s t u 9