4 Part 3: Vacation Destination 6. 7 # Ask the user if they want to travel 8 vacation = input ("Do you want to go on vacation? Enter y/n: ") == "y" 9. 10 # If the user wants to travel, get some more information from them 11 if vacation == True: ocean = input ("Do you like being near the ocean? Enter y/n: ") == hot = input ("Do you want to be somewhere hot? Enter y/n: ") animals = input ("Do you like seeing exotic animals? Enter y/n: ") == 12 "y" 13 14 15 # If the user likes it hot, likes being near the ocean # and likes exotic animals then they should go to Brazil 16 18 elif ocean and hot or animals == True: 19 20 print ("You should go to Brazil.") # If # the 23 elif hot == user likes it hot or likes exotic animals hey should go to Uganda True and animals == True: print ("You should go to Uganda.") 21 22 24 25 # If they don't like any of the options then they should go to Russia 26 27 else: 28 29 30 31 32 print ("That's okay, there are lots of fun things to do here too.") print ("You should visit Russia.") # If the user doesn't want to travel, print a messageelse: 1112N2
Step 1 : Take input from the user in they wish to go on a Vacation.
Step 2 : If the user inputs y , then proceed with the following if block , else proceed with it's respective else block.
Step 3 : Take input from the user if they Like being near ocean or if they wish to be somewhere hot or if they would like to see exotic animals.
Step 4 : If the User enters y for all the above mentioned options , then proceed with the respective if block and print 'they should visit Brazil.'
Step 5 : If the User enters y for if they would like to be in a Hot place OR like to see exotic Animals, then proceed with it's respective else if block of code and print 'they should visit Uganda.'
Step 6 : If the user selects n for all of the above mentioned choices then proceed with the respective else block of code and print 'they should visit Russia.'
Step 7 : If the user inputs n in the first case then proceed with it's respective else block of code and print 'there are many fun things to do here.'
Step 8 : Stop
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images