Conditional Execution Power Point Flashcards
Nested conditionals with IF inside another If statement
Having an if statement inside another if statement
if x == y:
print(‘x and y are equal’)
else:
if x < y:
print(‘x is less than y’)
else:
print(‘x is greater than y’)
Alternative execution example 2
if x < y:
print(‘x is less than y’)
elif x > y:
print(‘x is greater than y’)
else:
print(‘x and y are equal’)
Alternative execution example 1
if x%2 == 0 :
print(‘x is even’)
else :
print(‘x is odd’)
if statement:
Execute this line if statement is true
elif statement2:
Execute this line if statement2 is true
else:
If both statements are false execute this line
Programs (try & except)/ if statements, provide an argument
Learn how to:
Def variable name():
How to ask for an argument w/ Functions.
How to do a function without an argument.