Hands On Exercise

We'll cover the following

Congratulations on completing the lesson on Python lists. In today’s exercise, we’ll be manipulating a list containing some song names in order to solidify our knowledge of lists. Let’s get started!

Exercise 1

Remove elements at the indices 1, 2, and 3 from the list containing the song names below. Use an approach that consists of the range of indices.

Press + to interact
top_song_list = ['Comfortably Numb', 'Time', 'Life On Your Own', 'Dream On', 'Nothing Else Matters', 'Neon Lights']
print(top_song_list)
____________
____________

Exercise 2

Modify the name of the first song to include the name of the performer as well. Comfortably Numb is by Pink Floyd, and the new name should be of the format “Comfortably Numb - Pink Floyd”.

Press + to interact
top_song_list = ['Comfortably Numb', 'Time', 'Life On Your Own', 'Dream On', 'Nothing Else Matters', 'Neon Lights']
print(top_song_list)
____________
____________

Exercise 3

Suppose the length of the list is unknown. Your task is to print the last index of the top_song_list. 

Press + to interact
top_song_list = ['Comfortably Numb', 'Time', 'Life On Your Own', 'Dream On', 'Nothing Else Matters', 'Neon Lights']
____________