Python Syntax Review Flashcards

(34 cards)

2
Q

del

A

deletes objects, i.e. from lists or dictionaries

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

global

A

takes an object declared outside a function and uses it within that function

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

assert

A

figures out if a certain criteria is met, and if it is not, prints an AssertionError

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

pass

A

passes the code from the current iteration of a for-loop to the code following it within the loop

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

continue

A

sends a for-loop to the next iteration without executing the code that follows it within the loop

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

yield

A

maintains the status of a function while returning a value in that state of the function

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

break

A

stops a loop from continuing to run

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

class

A

used to create a new object class

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

exec

A

executes a string of text as code

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

raise

A

raises an exception

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

finally

A

at the end of a try block, runs code no matter which branch of the block was followed

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

lambda

A

used to establish a one-off function anonymously

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

%d

A

decimal format

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

%i

A

integer format

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

%o

A

octal format

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

%u

A

unsigned decimal integer format

18
Q

%x

A

lowercase hexadecimal format

19
Q

%X

A

uppercase hexidecimal format

20
Q

%e

A

lowercase exponential format

21
Q

%E

A

uppercase exponential format

22
Q

%f

A

floating point decimal format

23
Q

%F

A

floating point decimal format

24
Q

%g

A

same as e if exponent is greater than -4 or less than precision, f otherwise

25
Q

%G

A

same as E if exponent is greater than -4 or less than precision, f otherwise

26
%c
single character format
27
\a
ASCII bel
28
\b
ASCII backspace
29
\f
ASCII Formfeed
30
\n
ASCII Linefeed
31
\r
ASCII Carriage Return
32
\t
ASCII horizontal tab
33
\v
ASCII vertical tab
34
,
creates a tuple, which is a list of values separated by commas
35
:
slice syntax which "slices out" sub parts in sequences