Display the list in the following format: ARTIST NAME(album name, track #): song title, where • the artist name is displayed in ALL CAPS, • the album name and track # follow immediately inside parenthesis, • followed by a colon, • followed by the song title (in the title format). The song titles should line up.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question

In python language, including print(song)

Starter Pack (e03-songs.py)
Display this interesting collection of music in a pretty format.
Use the string methods: title, upper, ljust
See expected output
def displaySong(song):
# TODO: make this look nicer, note song is a list.
print(song)
# list of a list of songs ( artist, title, album, track # )
# do not modify the song 1ist, use string formatting in the displaySong function
music_collection = [
["Sturgill Simpson', 'Poor Rambler', 'High Top Mountain', 11],
['Cherish', 'Unappreciated', 'Unappreciated', 2],
['Townes Van Zandt', "Waitin' Around to Die", "For the Sake of the Song",
['Kendrick Lamar', 'Money Trees', 'good kid, m.A. A.d city (Deluxe)', 5]
, 5]
print("Music Library".center (80, '='))
for song in music_collection:
displaySong(song)
Expected Output
whitespace is important here!
====Music Library====
STURGILL SIMPSON(High Top Mountain, 11):
CHERISH(Unappreciated, 2):
TOWNES VAN ZANDT (For the Sake of the Song, 5):
KENDRICK LAMAR(good kid, m.A.A.d city (Deluxe), 5):
Poor Rambler
Unappreciated
Waitin Around To Die
Money Trees
Transcribed Image Text:Starter Pack (e03-songs.py) Display this interesting collection of music in a pretty format. Use the string methods: title, upper, ljust See expected output def displaySong(song): # TODO: make this look nicer, note song is a list. print(song) # list of a list of songs ( artist, title, album, track # ) # do not modify the song 1ist, use string formatting in the displaySong function music_collection = [ ["Sturgill Simpson', 'Poor Rambler', 'High Top Mountain', 11], ['Cherish', 'Unappreciated', 'Unappreciated', 2], ['Townes Van Zandt', "Waitin' Around to Die", "For the Sake of the Song", ['Kendrick Lamar', 'Money Trees', 'good kid, m.A. A.d city (Deluxe)', 5] , 5] print("Music Library".center (80, '=')) for song in music_collection: displaySong(song) Expected Output whitespace is important here! ====Music Library==== STURGILL SIMPSON(High Top Mountain, 11): CHERISH(Unappreciated, 2): TOWNES VAN ZANDT (For the Sake of the Song, 5): KENDRICK LAMAR(good kid, m.A.A.d city (Deluxe), 5): Poor Rambler Unappreciated Waitin Around To Die Money Trees
Write a python program, using string methods, to
print the list of songs out in a pretty format. The list is
formatted as:
• first element is the artist name,
• second element is the song title,
• third element is the album name,
• and last element is the track #.
Display the list in the following format: ARTIST
NAME(album name, track #): song title, where
• the artist name is displayed in ALL CAPS,
• the album name and track # follow immediately
inside parenthesis,
• followed by a colon,
• followed by the song title (in the title format). The
song titles should line up.
The following string methods will be useful for solving
this problem:
• ljust().
upper().
title().
Starter Pack (e03-songs.py)
Display this interesting collection of music in a pretty format.
Use the string methods: title, upper, ljust
See expected output
def displaySong(song):
# TODO: make this look nicer, note song is a list.
print(song)
# list of a list of songs ( artist, title, album, track # )
# do not modify the song list, use string formatting in the displaySong function
music_collection = [
['Sturgill Simpson', 'Poor Rambler', 'High Top Mountain', 11],
['Cherish', 'Unappreciated', 'Unappreciated', 2],
['Townes Van Zandt', "Waitin' Around to Die", "For the Sake of the Song", 5]
['Kendrick Lamar', 'Money Trees', 'good kid, m.A.A.d city (Deluxe)', 5]
print("Music Library".center(80, '='))
for song in music_collection:
displaySong(song)
Expected Output
whitespace is important here!
========Music Library====
====:
STURGILL SIMPSON(High Top Mountain, 11):
CHERISH(Unappreciated, 2):
TOWNES. VAN. ZANDIC For the Sake of the Song.
Poor Rambler
Unappreciated
Waitin Around To Die.
5):
Transcribed Image Text:Write a python program, using string methods, to print the list of songs out in a pretty format. The list is formatted as: • first element is the artist name, • second element is the song title, • third element is the album name, • and last element is the track #. Display the list in the following format: ARTIST NAME(album name, track #): song title, where • the artist name is displayed in ALL CAPS, • the album name and track # follow immediately inside parenthesis, • followed by a colon, • followed by the song title (in the title format). The song titles should line up. The following string methods will be useful for solving this problem: • ljust(). upper(). title(). Starter Pack (e03-songs.py) Display this interesting collection of music in a pretty format. Use the string methods: title, upper, ljust See expected output def displaySong(song): # TODO: make this look nicer, note song is a list. print(song) # list of a list of songs ( artist, title, album, track # ) # do not modify the song list, use string formatting in the displaySong function music_collection = [ ['Sturgill Simpson', 'Poor Rambler', 'High Top Mountain', 11], ['Cherish', 'Unappreciated', 'Unappreciated', 2], ['Townes Van Zandt', "Waitin' Around to Die", "For the Sake of the Song", 5] ['Kendrick Lamar', 'Money Trees', 'good kid, m.A.A.d city (Deluxe)', 5] print("Music Library".center(80, '=')) for song in music_collection: displaySong(song) Expected Output whitespace is important here! ========Music Library==== ====: STURGILL SIMPSON(High Top Mountain, 11): CHERISH(Unappreciated, 2): TOWNES. VAN. ZANDIC For the Sake of the Song. Poor Rambler Unappreciated Waitin Around To Die. 5):
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning