Question: Step 2 : Create an if / elif / else function. What if we have more than two conditional statements to consider? In this case,

Step 2: Create an if/elif/else function.
What if we have more than two conditional statements to consider? In this case, we can use elif statements in the middle of the if/else function. An elif statement is evaluated if the if statement is false and before the else statement. You can have as many elif statements as you would like. However, the first one matched will be executed and none of the remaining elif statements will be checked. Nor will the else statement.
The script in the following example asks the user to input the number of an IPv4 ACL and then checks whether that number is a standard IPv4 ACL, extended IPv4 ACL, or neither standard or extended IPv4 ACL. a. Create this script for your files. Open a blank script and save it as if-acl.py. Copy the script into the file.
aclNum = int(input("What is the IPv4 ACL number? ")) if aclNum >=1 and aclNum <=99:
print("This is a standard IPv4 ACL.") elif aclNum >=100 and aclNum <=199:
print("This is an extended IPv4 ACL.") else:
print("This is not a standard or extended IPv4 ACL.")

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!