Question: How do I solve this problem using logical operators such as (and, or, not) in python? It requires using only logical operators in python to

How do I solve this problem using logical operators such as (and, or, not) in python?

 How do I solve this problem using logical operators such as

(and, or, not) in python? It requires using only logical operators in

It requires using only logical operators in python to solve this problem. using the if, elseif etc won't work here based on the setup.

Console output will be displayed here 1 exam = False 2 sunny = False 3 sunblock = False 4 morning classes = True 5 night_classes = True 6 raining = False 7 rain jacket = True 8 snowing = False 9 friends_are_going = True 10 fluffy_coat = False 11 snow boots = True 12 really_want_to_go = True 13 14 #You may modify the lines of code above, but don't move them! 15 #When you Submit your code, we'll change these lines to 16 #assign different values to the variables. 18 #Imagine you commute to your classes and want to write code to 19 #determine when it is appropriate for you to go to class based 20 #on the following conditions: 21 22 # - If you have an exam, then you should go to class, regardless 23# of the weather. 24 # - If you do not have an exam and it is sunny outside, then you 25 # want to go to class if either of the following are true: you have sunblock and your classes are in the morning or your 27 # classes are at night. 28 # - If you do not have an exam and it is raining outside, then 29 # you want to go to class if you have a rain jacket. 30 # - If you do not have an exam and it is snowing, then you want 31 # to go if any of the following are true: your friends are 32 # going and you have a fluffy coat, you have snow boots and a 33 # fluffy coat, or you just really want to go to class. 34 35 #If none of the previously stated conditions are true, then you 36 #do not want to go to class. 37 38 #Once you have determined if you should go to class, print the 39 #Following statement without the quotation marks, where 40 #corresponds to the boolean that you have found: 41 "True or false: I should go to class: . Console output will be displayed here 33 15 #When you submit your code, we'll change these lines to 16 #assign different values to the variables. 18 #Imagine you commute to your classes and want to write code to 19 #determine when it is appropriate for you to go to class based 20 #on the following conditions: 21 # 22 # - If you have an exam, then you should go to class, regardless 23 # of the weather. 24 # - If you do not have an exam and it is sunny outside, then you 25 # want to go to class if either of the following are true: you 26 # have sunblock and your classes are in the morning or your 27 # classes are at night. 28 # - If you do not have an exam and it is raining outside, then 29 # you want to go to class if you have a rain jacket. 30 # - If you do not have an exam and it is snowing, then you want 31 to go if any of the following are true: your friends are 32 going and you have a fluffy coat, you have snow boots and a Fluffy coat, or you just really want to go to class. 34 35 #If none of the previously stated conditions are true, then you 36 do not want to go to class. 37 38 #Once you have determined if you should go to class; print the 39 #following statement without the quotation marks, where 1. 40 #corresponds to the boolean that you have found: 41 "True or False I should go to class: 42 43 Add your code here! With the initial inputs, your code 44 #should print: 45 True or False I should go to class: False 46 have_exam = exam and sunny or raining or snowing, 47 do_not_have_exam_1 = exam and sunny or (sunblock) and (morning_classes or night_classes) 48 do_not_have_exam_2 = exam and rain jacket 49 want to go exam and snowing and friends_are_going and fluffy_coat and snow_boats or really want_to_go) 50 will_not_go = have_exam and do_not_have_exam_1 and do_not_have_exam_2 and want_to_go 51 print("True or false. I should go to clss:", will_not_go) 52 53

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!