exam2020 Flashcards
1
Q
A
2
Q
A
- First, two variables are defined:
python true = True false = False
- The code then has an if-elif-elif-else chain. In Python, only the first condition that evaluates to True will be executed, and then the chain stops.
- Let’s examine each condition:
- First condition:
if false:
- Since
false
is False, this is skipped
- Since
- Second condition:
elif true:
- Since
true
is True, this condition is met - Therefore
"Second output!"
is printed - Important: Once this condition is met, Python exits the entire if-elif-elif-else chain
- Since
- First condition:
3
Q
A
4
Q
A
5
Q
A
6
Q
A
7
Q
A
8
Q
A
9
Q
A
10
Q
A
11
Q
A
12
Q
A
13
Q
A
14
Q
A
15
Q
A