Python Builtin Functions Flashcards
builtin function
print(*objects, sep=’ ‘, end=’\n’, file=None, flush=False)
input
builtin function
input(prompt=””)
save user input into var: variable = input(“what is your name?\n”)
len
builtin function
len(sequence|collection)
returns object length (the number of items)
sequence: string, bytes, tuple, list, or range
collection: dictionary, set, or frozen set etc.
type
type(object)
returns type of object
id
id(object)
returns a int that represents the “identity” of an object
CPython: this is the memory address of the object
sum
sum(iterable, /, start=0)
Sums start and the items of an iterable from left to right and returns the total
round
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.