I've had this python exercise I've been trying to do for a while but it's not working.
In the exercise, I defined a function make_album that accepts two parameters: artistName and albumTitle.
The function should have a While loop that allows users to enter an album's artist and title. Once I have that information, I call the function and it returns a string with these information.
The While loop is meant to keep asking for the user's input until they type in "Quit" which is meant to break the loop and stop the code from running..
In the first of numerous trial and error, I did this:
def make_album(artistName, albumTitle):
code_run = input("Enter 'CONTINUE' to continue code or 'QUIT' to quit code: ")
respond = 'My favorite artist is ' + artistName + ' and their latest album is ' + albumTitle
while code_run == 'continue':
artistName = input("What is your favorite artist's name? ")
albumTitle = input("What is their latest album? ")
if code_run == 'quit':
break
return respond
res = make_album(artistName, albumTitle)
print(res)
The problem is that when I call the function, the arguments in the function call is somehow "not defined". I don't know what the problem is.
I've tried just putting the input prompt in the function call itself as arguments. It worked but it did not run itself again automatically like it's meant to.