Python 3rd Quarter Flashcards

1
Q

segment of code that performs a single task

A

Function

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

functions already made in Python

A

Built-in functions

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

functions made by the user

A

User defined functions

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

variable defined inside a function

A

Local variable

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

variable defined outside a function

A

Global variable

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

creates an anonymous function

A

Lambda

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

stores elements in last-in first-out fashion

A

Stack

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

what the header of a function consists of

A

Function name and parameter list

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

a loop within a loop

A

Nested loop

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

2 main types of functions

A
  • Built-in function

- User defined function

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

where arguments to functions always appear in

A

Parentheses

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

returns the absolute value

A

abs( )

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

returns the length of an object

A

len( )

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

returns largest item in an iterable

A

max( )

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

returns smallest item in an iterable

A

min( )

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

returns a new sorted list from the items in alphanumeric order

17
Q

returns the given sequence in reverse

A

reversed( )

18
Q

rounds a decimal value to the nearest integer

19
Q

sums the numeric values in an iterable

20
Q

short way of creating assignment statements when the variable is both at the left and right side

A

Shortcut operators

21
Q

opens file object for reading or writing

22
Q

common modes of interaction in opening files

A
r - reading plain text; default
w - writing plain text
a - appending plain text in existing file
rb - reading binary data
wb - writing binary data
23
Q

closes opened file

24
Q

reads all data from file into one text string

25
reads each line from file one at a time
readline( )
26
removes leading and trailing characters
strip( )
27
removes trailing characters
rstrip( )
28
removes leading characters
lstrip( )
29
allows us to execute a statement or group of statements multiple times
Loop
30
types of loops
- for loop | - while loop
31
repeats statement/s a fixed number of times
for loop
32
repeats statement/s while the condition is True
while loop