Anyone Can Code.
You can use another conditional statement called elif which basically gives a an
alternative set of conditions. If the input doesn't meet the previous requirements, you
can use as many elif statements as you want to create alternative
conditions.
x = 15
if x > 15:
print('x is greater than 15')
elif x <= 15: #second condition- if the first condition isnt true then it checks whether this condition has been met.
print('x is less than or equal to 15')
x is less than or equal to 15
That's it for this tutorial! Click Next to access the next tutorial!
This site uses cookies to improve your experience as well as for site metrics. To see more, check out our Privacy Policy