Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

How to print letters from a-n:

a b c d e f g h i j k l m n 

How to print every second element in a-n:

a c e g i k m

Then, Is there any way to append a-n to the index of URL's {hello.com/, hej.com/, ..., hallo.com/}:

hello.com/a hej.com/b ... hallo.com/n

1 Answer

0 votes
by (26.4k points)

Try:

>>> import string

>>> string.ascii_lowercase[:14]

'abcdefghijklmn'

>>> string.ascii_lowercase[:14:2]

'acegikm'

You can also do like this, for url's

[i + j for i, j in zip(list_of_urls, string.ascii_lowercase[:14])]

Are you Interested to learn python ? Join our python course
For more details, do check out..

Related questions

0 votes
4 answers
asked Apr 6, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Jul 16, 2019 in Python by leealex956 (7.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...