If I have a string
alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
and I want to make a list like
alph = ["A", "B", "C", ...]
How would I do it?
If I have a string
alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
and I want to make a list like
alph = ["A", "B", "C", ...]
How would I do it?
python already gives us the uppercase letters as a string we can convert it to a list.
from string import ascii_uppercase
print(list(ascii_uppercase))
OUTPUT
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
You mean something like this?
list(alph)
Output:
[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]