I want to create a list from a to z, and from A to Z. Plese help me!
Asked
Active
Viewed 1,029 times
-5
-
2from `string` module `string.ascii_letters` – deadshot Jul 20 '20 at 14:14
-
1Welcome to SO! Please take the [tour] and read [ask]. SO is not a code-writing service, and you're expected to do at least a bit of research yourself before asking a question. – wjandrea Jul 20 '20 at 14:19
1 Answers
0
You can use the string
module, with string.ascii_uppercase
and string.ascii_lowercase
.
If you type:
import string
string.ascii_uppercase
You get:
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
If you type:
string.ascii_lowercase
You'll get the same result, but in lowercase.
To solve your problem you can do:
import string
upper_case = list(string.ascii_uppercase)
lower_case = list(string.ascii_lowercase)
upper_case
and lower_case
will be both lists ranging from a to z.