Conditional Execution Power Point Flashcards

1
Q

Nested conditionals with IF inside another If statement

A

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’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Alternative execution example 2

A

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’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Alternative execution example 1

A

if x%2 == 0 :
print(‘x is even’)
else :
print(‘x is odd’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Programs (try & except)/ if statements, provide an argument

A

Learn how to:
Def variable name():
How to ask for an argument w/ Functions.
How to do a function without an argument.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly