Write a function music_func that takes 3 parameters music type, music group, vocalist and prints them all out as shown in the example below.
In case no input is provided by the user, the function should assume these values for the parameters: "Classic Rock", "The Beatles", "Freddie Mercury".
For example:
Input:
Alternative Rock,Pearl Jam,Chris Cornell
Output:
The best kind of music is Alternative Rock
The best music group is Pearl Jam
The best lead vocalist is Chris Cornell
Note : The print statements will go inside the music_func(). For example:
print("The best kind of music is" + ...)
#definition for music_func goes here
def music_func(a,b,c):
if a is None or b is None or c is None:
print("The best kind of music is Classic Rock")
print("The best music group is The Beatles")
print("The best lead vocalist is Freddie Mercury")
else:
print("The best kind of music is",a)
print("The best music group is",b)
print("The best lead vocalist is",c)
return
def main():
music, group, singer = input().split(',')
music_func(music, group, singer)
music_func() #This is suppose to print the first if-statements
main()
You can utilize default arguments
def music_func(a="Beatles", b="Classic Rock", c="Freddie"):
Now calling the function with no arguments will default to using these options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With