Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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

0 votes
4 answers
asked Apr 6, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Dec 10, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.6k points)
0 votes
4 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...