Colab

song = """Yeah yeah yeah yeah yeah yeah
Yeah yeah yeah yeah yeah yeah
I think I did it again
I made you believe we're more than just friends
Oh baby
It might seem like a crush
But it doesn't mean that I'm serious
'Cause to lose all my senses
That is just so typically me
Oh baby, baby""".splitlines()


song = ['Yeah yeah yeah yeah yeah yeah',
 'Yeah yeah yeah yeah yeah yeah',
 'I think I did it again',
 "I made you believe we're more than just friends",
 'Oh baby',
 'It might seem like a crush',
 "But it doesn't mean that I'm serious",
 "'Cause to lose all my senses",
 'That is just so typically me',
 'Oh baby, baby']

song

['Yeah yeah yeah yeah yeah yeah',
 'Yeah yeah yeah yeah yeah yeah',
 'I think I did it again',
 "I made you believe we're more than just friends",
 'Oh baby',
 'It might seem like a crush',
 "But it doesn't mean that I'm serious",
 "'Cause to lose all my senses",
 'That is just so typically me',
 'Oh baby, baby']
song_with_line_numbers = list(enumerate(song, 1))

song_with_line_numbers

[(1, 'Yeah yeah yeah yeah yeah yeah'),
 (2, 'Yeah yeah yeah yeah yeah yeah'),
 (3, 'I think I did it again'),
 (4, "I made you believe we're more than just friends"),
 (5, 'Oh baby'),
 (6, 'It might seem like a crush'),
 (7, "But it doesn't mean that I'm serious"),
 (8, "'Cause to lose all my senses"),
 (9, 'That is just so typically me'),
 (10, 'Oh baby, baby')]
i, item = (1, 'Yeah yeah yeah yeah yeah yeah')

i

1
item

'Yeah yeah yeah yeah yeah yeah'
for i, item in enumerate(song):
    print(i, ':', item)

0 : Yeah yeah yeah yeah yeah yeah
1 : Yeah yeah yeah yeah yeah yeah
2 : I think I did it again
3 : I made you believe we're more than just friends
4 : Oh baby
5 : It might seem like a crush
6 : But it doesn't mean that I'm serious
7 : 'Cause to lose all my senses
8 : That is just so typically me
9 : Oh baby, baby
words = "the quick brown fox jumped over the lazy dog".split()

for i, word in enumerate(words):
    words[i] = word.capitalize()

words

['The', 'Quick', 'Brown', 'Fox', 'Jumped', 'Over', 'The', 'Lazy', 'Dog']
fruits = [
    'apple',
    'mango',
    'pear',
    'grapes'
]

prices = [
    14,
    7,
    8,
    25
]

list(zip(fruits, prices))

[('apple', 14), ('mango', 7), ('pear', 8), ('grapes', 25)]
for fruit, price in zip(fruits, prices):
    print(fruit, price)

apple 14
mango 7
pear 8
grapes 25
dict (fruits, prices)


    ---------------------------------------------------------------------------

    TypeError                                 Traceback (most recent call last)

    <ipython-input-27-f21d9a0d94b6> in <module>
    ----> 1 dict (fruits, prices)
    

    TypeError: dict expected at most 1 arguments, got 2


dict(zip(fruits, prices))

{'apple': 14, 'mango': 7, 'pear': 8, 'grapes': 25}