Question: We're checking for days and weather conditions. In this program, we're using nested conditionals. This is not efficient and we want to use the

We're checking for days and weather conditions. In this program, we're using

We're checking for days and weather conditions. In this program, we're using nested conditionals. This is not efficient and we want to use the and logical operator instead. Re-write this nested conditional statement into a single conditional (if-elif-else) statement using the and operator. Click Run to check your code. Click Submit to submit your code to your instructor. Run 1 # Set variables 2 day="Friday" 3 weather "cloudy" 4 Redo 8 9- 5 # Write your if-else statement below 6 if day="Friday": 7- if(weather ="sunny"): 10 11 else: 12 - 13 14- 15 Save else: print("It is Friday and sunny!"). print("It is Friday and not sunny!") Submit if(weather =="sunny"): else: print("It is not Friday and sunny!") print("It is not Friday and not sunny!") Hint Your Output: Desired Output: It is Friday and not sunny!

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python program that uses ifelifelse with and operator to disp... View full answer

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 Programming Questions!