#mastery17 Use of “elif” with a conditional

This is similar to an “else” but instead of doing something if the first condition is not fulfiled, this will make another condition in case the first one isnt fulfiled. For example:

num=2

if (num>3):

print (“Hello”) #  wont print this because the condition is not fulfiled (false)… this line must be idented so it can be part of the “if”

elif (num==2):

print (“Goodbye”) # the condition wasnt fulfiled the “elif” will take place and it’ll print Goodbye… this line must be idented so it can be part of the “elif”

CC BY 4.0 #mastery17 Use of “elif” with a conditional by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.