Control flow & Conditions Flashcards

1
Q

What is a conditional test?

A

An expression that can be evaluated as True or False.

A Boolean exptression.

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

What are Boolean values?

A

True and False

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

If age is greater or equal to 18, print “You can vote”, else print (“You can’t vote yet”)

A

if age >= 18:
print(“You can vote”)
else:
print(“You can’t vote yet”)

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

Which keyword you need to check two conditions are true in order to execute a block of code?

A

and

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

True and True is…

A

True

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

True and False is…

A

False

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

False and False is…

A

False

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

Which keyword you need to check if at least one of two conditions is true in order to execute a block of code?

A

or

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

True or True is…

A

True

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

True or False is…

A

True

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

False or False is…

A

False

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

Find if “U2” is in list rock_bands.

A

if “U2” in rock_bands:

….

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

Find if “U2” is not in list rock_bands.

A

if “U2” not in rock_bands:

….

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

Check if name_list is not empty

A

if name_list:

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