Python Functions

Python abs() Function

The abs() built-in Python function calculates absolute value of a number. It takes one input x. For negative numbers (x < 0) it returns -x. For positive numbers and zero (x >= 0) it returns x. Input data types Typical arguments to the abs() function are int or float types. The argument [more...]

Python all() Function

The built-in Python function all() checks if all items in a sequence (such as a list, tuple, or set) are True. It takes one input iterable. If all items in iterable evaluate to True, all(iterable) returns True. Otherwise, if at least one item evaluates to False, it returns False. [more...]

Python any() Function

Python any() function takes a sequence as input (such as a tuple or list) and checks if at least one item is True. If at least one item in the input iterable is True, any() returns True. If all items evaluate to False, it returns False. If the input iterable [more...]

Python type() Function

Python type() function has two variants. The more common variant with a single argument is used to determine the data type of a variable or object in Python. It returns the class of the object that is passed as an argument. This page explains this variant and its use cases. [more...]

Python type() Function with Three Arguments

The type() function is commonly used with a single argument - the variable whose data type we want to check. It returns an existing type object - the type of the input variable. For instance, if passed an int like 123, it returns the int type. However, there is another variant with [more...]

By remaining on this website or using its content, you confirm that you have read and agree with the Terms of Use Agreement.

We are not liable for any damages resulting from using this website. Any information may be inaccurate or incomplete. See full Limitation of Liability.

Content may include affiliate links, which means we may earn commission if you buy on the linked website. See full Affiliate and Referral Disclosure.

We use cookies and similar technology to improve user experience and analyze traffic. See full Cookie Policy.

See also Privacy Policy on how we collect and handle user data.

© 2024 PyTut