Topic 2 - Session 2 - MTA Intro Course Flashcards

1
Q

What is the elif statement short for?

A

else if

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

Does order matter when doing if and elif statements?

A

Yes - the order matters when using comparisons

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

What is another name for “if all else fails” statement?

A

else statement

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

In simple terms, explain the logic behind a while loop

A

A while loop means, ‘while something is True or False, run this code.

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

In simple terms, explain the logic behind a for loop

A

A for loop is set to run a certain number of times.

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

What is a break statement used for?

A

A break statement is used to break out of a While loop or a for loop, and to execute the code that follows the loop.

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

Why might you use the ‘pass’ condition in a python script?

A

A pass condition is used as a placeholder for future code.

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