Hide

Problem A
Music

Write a function, state_music_opinion(genre, music_group, vocalist), that prints out certain music preferences, as detailed below.

The main file, which handles input and output, is already provided. - Please only submit your function definitions, without any code outside the functions!

Input

The function should accept three strings, $g$, $b$ and $s$, in this order, as parameters, but in case some of the arguments are not provided the function should also default to the following values for those arguments that are not provided: “Classic Rock” for $g$, “The Beatles” for $b$, and “Freddie Mercury” for $s$.

In the samples below, the first and only line of the input contains the three strings seperated by a “,”. The autograder will handle reading the input, splitting it on the commas and passing the resulting list as an argument to your function. In case any of the strings are empty, or contain only whitespace, those particular values will not be passed to your function, in which case it should resort to the defaults.

Note that the parameters of the function will sometimes need to be referred to by name, so it is important that you use the following names for the parameters in your function definition: “genre” for $g$, “music_group” for $b$, and “vocalist” for $s$.

In the tests, the strings $g$, $b$ and $s$ will consist of printable ASCII characters, and have length at most $30$ each.

Output

The function should not return anything (just None), but should print out the following three lines:

  • “The best type of music is {$g$}.”

  • “The best music group is {$b$}.”

  • “The best lead vocalist is {$s$}.”

Sample Input 1 Sample Output 1
Rythm and blues,Greta Van Fleet,Luciano Pavarotti
The best type of music is Rythm and blues.
The best music group is Greta Van Fleet.
The best lead vocalist is Luciano Pavarotti.
Sample Input 2 Sample Output 2
Classical music,Uriah Heep,David Bowie
The best type of music is Classical music.
The best music group is Uriah Heep.
The best lead vocalist is David Bowie.
Sample Input 3 Sample Output 3
Heavy metal,Simon & Garfunkel,Linda Perry
The best type of music is Heavy metal.
The best music group is Simon & Garfunkel.
The best lead vocalist is Linda Perry.
Sample Input 4 Sample Output 4
,Simon & Garfunkel,
The best type of music is Classic Rock.
The best music group is Simon & Garfunkel.
The best lead vocalist is Freddie Mercury.
Sample Input 5 Sample Output 5
Classical music,,Linda Perry
The best type of music is Classical music.
The best music group is The Beatles.
The best lead vocalist is Linda Perry.
Sample Input 6 Sample Output 6
,,
The best type of music is Classic Rock.
The best music group is The Beatles.
The best lead vocalist is Freddie Mercury.

Please log in to submit a solution to this problem

Log in