FINALE LESSONS Flashcards

1
Q

With the ________ we can execute a set of statements as long as a condition is true.

A

While loop

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

With the _____________ we can stop the loop even if the while condition is true

A

break statement

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

With the ______________ we can run a block of code once when the condition no longer is true

A

else statement

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

With the ______________ we can stop the current iteration, and continue with the next:

A

continue statement

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

A __________ is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

A

for loop

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

With the ___________ we can execute a set of statements, once for each item in a list, tuple, set etc.

A

for loop

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

The for loop ____________ an indexing variable to set beforehand.

A

does not require

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

The ___________ in a for loop specifies a block of code to be executed when the loop is finished

A

else keyword

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

A __________ is a loop inside a loop.

A

nested loop

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

The __________ returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified number.

A

range() function

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

for loops cannot be empty, but if you for some reason have a for loop with no content, put in the _____________ to avoid getting an error.

A

pass statement

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

In Python a function is defined using the ____________

A

def keyword

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

The terms __________ and ___________ can be used for the same thing: information that are passed into a function.

A

parameter & argument

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

A parameter is the variable listed inside the parentheses in the function definition.

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

An argument is the value that is sent to the function when it is called.

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

If you do not know how many keyword arguments that will be passed into your function, add _______________ before the parameter name in the function definition.

A

two asterisk: **

11
Q

If you do not know how many arguments that will be passed into your function, add a ___ before the parameter name in the function definition.

A

*

11
Q

You can also send arguments with the key ___ value syntax

A

=