0 votes
1 view
in Python by (6.5k points)

Instead of making a list of the alphabet like this:

alpha = ['a', 'b', 'c', 'd'.........'z']

Is there any way that we can group it to a range or something? For example, for numbers, it can be grouped using range()

range(1, 10)

1 Answer

0 votes
by (107k points)

To group an alphabet Range in Python you can use the following code:-

import string 

String.ascii_lowercase

image

If you want all the alphabet in the list then you can use the below-mentioned code:-

list(string.ascii_lowercase)

image

Related questions

0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
asked Oct 14, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
asked Oct 11, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...