Any 3 Built in method in Python

The Python interpreter has a number of functions built into it that are always available. They are listed here in alphabetical order. ... Convert an integer number to a binary string. The result is a valid Python expression. If x is not a Python int object, it has to define a __index__() method that returns an integer.

Python abs()

The abs() method returns the absolute value of the given number. If the number is a complex number, abs() returns its magnitude.
The syntax of abs() method is:
abs(num)

abs() Parameters

The abs() method takes a single argument:
  • num - a number whose absolute value is to be returned. The number can be:
a.      integer
b.     floating number
c.      complex number

Return value from abs()

The abs() method returns the absolute value of the given number.
  • For integers - integer absolute value is returned
  • For floating numbers - floating absolute value is returned
  • For complex numbers - the magnitude of the number is returned

Python any()

The any() method returns True if any element of an iterable is True. If not, any() returns False.
The syntax of any() is:
any(iterable)

any() Parameters

The any() method takes an iterable (list, string, dictionary etc.) in Python.

Return Value from any()

any() returns:
  • True if at least one element of an iterable is true
  • False if all elements are false or if an iterable is empty

Python all()

The all() method returns True when all elements in the given iterable are true. If not, it returns False.
The syntax of all() method is:
all(iterable)

all() Parameters

The all() method takes a single parameter:

Return Value from all()

The all() method returns:
  • True - If all elements in an iterable are true
  • False - If any element in an iterable is false

To getting expect level training for Python training in your Location – Python training in Chennai | Python training institute in Chennai | Python Course institute in Chennai | Python training in Bangalore | Python training institute in Bangalore Python training in Electronic City Python training in Jaya Nagar | Python training in Pune | Python training institute in Pune | Python training in OMR | Python training in Velachery | Python training in Tambaram Python training in Annanagar | Python training in Marathahalli Python training in btm | Python Online Training | Online Certification Course Python Course in Chennai Python interview questions and answers | Python tutorials | Python training in Indira Nagar | Python Course in btm | Python Course in Marathahalli 



Comments

Popular posts from this blog

Python – Functions

What is Django in python?