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

A

sorted( )

17
Q

returns the given sequence in reverse

A

reversed( )

18
Q

rounds a decimal value to the nearest integer

A

round( )

19
Q

sums the numeric values in an iterable

A

sum( )

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

A

open( )

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

A

close( )

24
Q

reads all data from file into one text string

A

read( )

25
Q

reads each line from file one at a time

A

readline( )

26
Q

removes leading and trailing characters

A

strip( )

27
Q

removes trailing characters

A

rstrip( )

28
Q

removes leading characters

A

lstrip( )

29
Q

allows us to execute a statement or group of statements multiple times

A

Loop

30
Q

types of loops

A
  • for loop

- while loop

31
Q

repeats statement/s a fixed number of times

A

for loop

32
Q

repeats statement/s while the condition is True

A

while loop