min, max, type, len functions in Python
Functions can be of two types, user-defined or built-in. Since our topic sticks to built-in functions, let’s discuss them briefly.
Built-in function examples
print(): prints stuff on the screen
print("Hello World")
abs(): returns the absolute value (except strings)
print(abs(-4/3))
round(): returns the rounded value of the numeric value(rounding off the decimal value)
print(round(-4/3))
-
min(): returns the smallest item of a list given in the arguments (in strings also) -
max(): the opposite of the minimum – in other words – it returns the largest value of the list given in the argument
print(min(3, 2, 5))print(max('c', 'a', 'b'))
sorted(): list is sorted into ascending order, could be numbers or strings
arr = [3, 2, 5]print(sorted(arr))
len(): returns the number of elements in a list or the number of characters in a string
print(len('Hello World'))
type(): returns the variable type
a = Trueprint(type(a))