Lecture 5 Flashcards

escape character, lambda functions, and maps

1
Q

escape character + function

A

\

Reads the preceding character as a command rather than part of the string

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

\n

A

new line

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

horizontal tab using escape character

A

\t

types a tab key amount of space

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

carriage return (esc char) + function

A

\r

tells Python to move the cursor back to the beginning of the current line. So, when you execute this line, Python first prints “Hello”, then when it encounters \r, it moves the cursor back to the beginning of the line and continues printing. It then prints “World”.

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

back space (esc char) + function

A

\b

Moves the active position to the previous position on the current line

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

form feed (esc char) + fxn

A

\f

Form feed is a page-breaking ASCII control character. It forces the printer to eject the current page and to continue printing at the top of another

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

vertical tab (esc char) + fxn

A

\v

Prints the text next to it in a new line after a tab space

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

single and double quotes (esc char)

A

\’ and \”

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

backslash symbol (esc char)

A

\

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

lambda function (2) + syntax

A
  • a small anonymous function.
  • can take any number of arguments, but can only have one expression

lambda arguments : expression

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

maps (2) + syntax

A

A standard function that accepts at least two arguments, a function (ANY function) and an iterable

runs the lambda for each value in the iterable and returns a MAP OBJECT, which can be converted into another data structure

syntax:

typecast(map(function, iterable))

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

abs() function

A

returns absolute value of the input

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