Question: How do I solve this problem? The question requires that only logical operators (and, or and not) be used answer this question. [Executed at: Fri

How do I solve this problem?

 How do I solve this problem? The question requires that only

logical operators (and, or and not) be used answer this question. [Executed

The question requires that only logical operators (and, or and not) be used answer this question.

[Executed at: Fri Jan 21 1:17: 35 PST 2022] We found a few things wrong wi th your code. The first one is shown below, and the rest can be found in fuil_results.txt i n the dropdown in the top lef to 1 can afford = True 2 destination_is_safe = True 3 educational value = True 4 relatives_nearby = True 5 is international = True 6 have_passport = True 7 afraid_to_fly = True 8 have a car = True 9 is a beach = True 10 is_warm = False 11 has_skiing = True 12 is_a_city = True 13 is_off_peak = True 14 has attraction = False 15 16 #You may modify the lines of code above, but don't move them! 17 #when you Submit your code, we'll change these lines to 18 #assign different values to the variables. 20 #Imagine for a moment that you're a college student who wants 21 #to travel during spring break. You have a destination in 22 #mind. What determines whether you can go there? 23 24 #First, how would you pay for the trip? If you can afford it 25 #(can_afford), then all you need is for your parents to agree 26 #to let you go. Your parents will agree to let you go if the 27 #destination is safe (destination_is_safe). 28 # 29 #If you can't afford it, then you need your parents to pay for 30 #the trip. Your parents will pay for the trip if the destination 31 #is safe (destination_is_safe) and if either there is educational 32 #value (educational value) or there are relatives nearby for 33 you to visit (relatives_nearby)... 34 # 35 #Second, are you sure you're able to go to this location? If 36 #it's international (is_international), then you'll need a 37 #passport (have_passport) and you can't be afraid to fly 38 # (afraid_to_fly). If it's not international (is_international), 39 #then you either must have a car (have_a_car) or you can't be 40 #afraid to fly (afraid_to_fly). 41 We tested your code with can_a fford = True, destination_is_s afe = True, educational_value = False, relatives_nearby = Fa ise, is international = True, have_passport - True, afraid t o_fly = false, have_a_car = Tr ue, is_a_beach = True, is warm = True, has_skiing = False, is _a_city = False, is_off_peak = False, has_attraction = False. we expected your code to print this: True However, it printed this: False (Executed at: Fri Jan 21 1:17: 35 PST 2022] We found a few things wrong wi th your code. The first one is shown below, and the rest can be found in full_results.txt i n the dropdown in the top lef = 34 # 35 #Second, are you sure you're able to go to this location? If 36 #it's international (is international), then you'll need a 37 #passport (have_passport) and you can't be afraid to fly 38 #(afraid_to_fly). If it's not international (is_international), 39 #then you either must have a car (have_a_car) or you can't be 40 #afraid to fly (afraid_to_fly). 42 #Third, do you actually want to go to this location? If it's a 43 #beach location (is a beach), then you want the weather to be 44 #warm (is_warm). If it's instead a skiing location (has_skiing), 45 #you don't want it to be warm (is_warm). If it's a tourist city 46 #(is_a_city), then you either want it to be an off-peak travel 47 #time (is_off_peak) or you want there to be an attraction in 48 #town that week (has_attraction). 49 # 50 #If it's both a beach and a city, then you'd decide to go if it 51 #meets the condition for the beach (it's warm) or for a city 52 #(is an off-peak time or has an attraction). If it's both a 53 #skiing location and a city, then you'd decide to go if it meets 54 #either type of location's conditions as well. 55 # 56 #Your only goal here is to print True or False; True if the 57 #destination represented by the variables is an acceptable 58 #travel location, False if it is not. 60 #HINT: Don't try to do this all in one line. Break it into 61 #smaller parts. 62 63 64 #Add your code here! 65 afford = can_afford and destination_is_safe 66 parents = destination is_safe and educational_value or relatives nearby 67 passport = is_international and have_passport and afraid_to_fly or not is_international and have_a_car or not afraid_to_fly 68 beach = is_a_beach and not is_warm and has_skiing and is warm 69 tourist = is a city and is off_peak or has_attraction 70 both = is_a_beach and is_a_city and is_warm or is_off_peak or has_attraction 71 print(afford and parents and passport and beach and tourist and both) 72 We tested your code with can_a fford = True, destination_is_s afe = True, educational_value False, relatives nearby = Fa ise, is_international = True, have_passport = True, afraid_t o_fly = False, have_a_car = Tr ue, is_a_beach = True, is_warm = True, has_skiing = False, is _a_city = False, is_off_peak = False, has attraction = False. We expected your code to print this: = - However, it printed this: False R

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!