Let's see few important built-in functions in Python.
Starting alphabetically we will go through the functions beginning with character "a":
abs(x)
abs(x) returns the absolute value of a number. Arguments it takes can be anything like an integer or a floating point number. all(iterable)
all(iterable)
all(iterable) returns True if all elements of the iterable are true .
def all(iterable):
for element in iterable:
if not element:
return False
return True
any(iterable)
any(iterable) will return True if any element of the iterable is true. But if the iterable is empty, it will return False.
def any(iterable):
for element in iterable:
if element:
return True
return False
ascii(object)
We know that repr(), returns a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr()using \x, \u or \U escapes. It generates a string similar to that returned by repr().
In the next post we will see Built - in functions starting from letter "B" .
Comments