Python Builtin Functions Flashcards

1
Q

print

builtin function

A

print(*objects, sep=’ ‘, end=’\n’, file=None, flush=False)

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

input

builtin function

A

input(prompt=””)

save user input into var: variable = input(“what is your name?\n”)

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

len

builtin function

A

len(sequence|collection)

returns object length (the number of items)

sequence: string, bytes, tuple, list, or range
collection: dictionary, set, or frozen set etc.

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

type

type(object)

A

returns type of object

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

id

id(object)

A

returns a int that represents the “identity” of an object

CPython: this is the memory address of the object

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

sum

sum(iterable, /, start=0)

A

Sums start and the items of an iterable from left to right and returns the total

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

round

A

round(number, ndigits=None)
Return number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input.

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