Python Keywords Flashcards

1
Q

print

A

print to console

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

while

A

Controlling the flow of the program

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

for

A

Iterate over items of a collection in order that they appear

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

break

A

Interrupt the (loop) cycle, if needed

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

continue

A

Used to interrupt the current cycle, without jumping out of the whole cycle. New cycle will begin.

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

if

A

Used to determine, which statements are going to be executed (conditional)

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

elif

A

Stands for else if, if the first test evaluates to False, then it continues with the next one.

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

else

A

Is optional. The statement after the else keyword is excuted, unless the condition is True

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

is

A

Tets for object identity

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

not

A

Negates a boolean value

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

and

A

All conditions in a boolean expression must be met

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

or

A

At least one condition must be met

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

import

A

Import other modules into Python script

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

as

A

If we want to give a module a different alias

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

from

A

For importing a specific variable, class or a function from a module

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

def

A

Used to create a new defined function

17
Q

return

A

Exits the function and returns a value

18
Q

lambda

A

Creates a new anonymous function

19
Q

global

A

access variables defined outside functions

20
Q

try

A

Specifies exception handlers

21
Q

except

A

Catches the exception and executes codes

22
Q

finally

A

Is always executed in the end. Used to clean up resources

23
Q

raise

A

Create a user defined exception

24
Q

del

A

deletes objects

25
pass
Does nothing
26
assert
Used for debugging purposes
27
class
Used to create new user defined objects
28
exec
Executes Python code dynamically
29
yield
Is used with generators