Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (7.3k 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 (106k 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

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...