Question: Debug and fix this code. Then explain what was changed and why. def display _ welcome _ message ( ) : Display
Debug and fix this code. Then explain what was changed and why.
def displaywelcomemessage:
Display the welcome message."""
printWelcome Let's find an activity based on your preferences."
def getwhochoice:
Prompt the user to enter 'couple', 'group', or 'individual'."""
while True:
who inputPlease enter who will be participating individual couple, group or None to exit: lower
if who in individual 'couple', 'group':
return who
elif who 'none':
return None
else:
printInvalid input. Please enter 'individual', 'couple', 'group', or 'None' to exit."
def getwherechoice:
Prompt the user to enter 'indoors', 'outdoors', or 'river'."""
while True:
where inputWhere will the activity take place? indoors outdoors, river: lower
if where in indoors 'outdoors', 'river':
return where
else:
printInvalid input. Please enter 'indoors', 'outdoors', or 'river'."
def selectactivitywho where:
Return the activity based on who and where."""
activities
individual 'indoors': 'Crafts',
individual 'outdoors': 'Biking',
individual 'river': 'Fishing',
couple 'outdoors': 'Hiking',
group 'indoors': 'Scavenger hunt',
group 'outdoors': 'Rock climbing',
group 'river': 'Tubing'
return activities.getwho whereNo activity found for the given choices."
def main:
Main function to run the activity selection process."""
displaywelcomemessage
while True:
who getwhochoice
if who is None:
printExiting the program."
break
where getwherechoice
activity selectactivitywho where
printfThe selected activity for a who in the where is: activity
# Run the program
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
