0

I created a while loop that will continue until the user enters the variable 'favorite' as 'quit' or 'done'.

favorites = dict()
name = input('What is your name?\n')
favorite = input('What favorite do you want to enter? (quit or done to end)\n')
while favorite != 'done' or 'quit':
    favorite_item = input(f'What is your favorite {favorite}?\n')
    favorites[favorite] = favorite_item
    favorite = input('What favorite do you want to enter? (quit or done to end)\n')

When I tried to make the sentinel value just 'done' or 'quit' the while loop ended, but if I tried adding both it became an infinite loop.

0 Answers0