create a playlist

 create a playlist 

playlist = ['Song A', 'Song B', 'Song C']

# Display each song with its rank

print("Song 1: " + playlist[0])

print("Song 2: " + playlist[1])

print("Song 3: " + playlist[2])


  • playlist = ['Song A', 'Song B', 'Song C']: Here, we create a list called playlist.

  • print ("Song 1: "+ playlist[ 0]): This line prints text "Song 1:"  followed by the first song of the list, 'Song A'.
Output :

Song 1: Song A
Song 2: Song B
Song 3: Song C


  • You have to must try in your python compiler use idle avoid online compilers to Errors

Post a Comment

0 Comments