Question: Python Lab 3a: if statements with else and elif 1. Write an if statement to determine if a number is divisible by 5. Ask the

Python Lab 3a: if statements with else and elif 1. Write an if statement to determine if a number is divisible by 5. Ask the user to enter a number. Determine if the number is divisible by 5. if (number % 5 == 0): print (str(number) + ' is divisible by 5') 2. Write an if/else statement. An else statement can follow an if statement. The code in an else statement is executed if the expression in the if statement is false. if (number % 5 == 0): print (str(number) + is divisible by 5') else: print (str(number) + ' is divisible by 5') Notice that an else statement does not have a Boolean expression. Write an additional if/else statement to see if the number is divisible by 2. Test your code with many different inputs. S1. Take a Screenshot of your code and output (Label it 3-A) 3. Write an if/elif/else sequence. The command elif can be used to make a series of if statements more efficient. As soon as one of the expressions is true, the other ones are skipped. elif is short for 'else if'. Ask the user to enter a State/Province name, and print out the capital of that state. Your code should handle at least 6 different inputs. Use an if/elif/else structure if (state == 'Wisconsin'): print ("Madison') elif (state == 'Colorado)': print('Denver') else: print ('I do not know that one') Test your code with many different input values. S2. Take a Screenshot of your code and output (Label it 3-B)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
