pow() Function - Python Last Updated : 14 Apr, 2025 Comments Improve Suggest changes Like Article Like Report pow() function in Python is a built-in tool that calculates one number raised to the power of another. It also has an optional third part that gives the remainder when dividing the result. Example: Python print(pow(3,2)) Output9 Explanation: pow(3, 2) calculates 32 = 9, where the base is positive and the exponent is positive.Syntax of pow() functionpow(x, y, mod)Parameters: x : Number whose power has to be calculated.y : Value raised to compute power.mod [optional]: if provided, performs modulus of mod on the result of x**y (i.e.: x**y % mod)Returns: It returns the value x**y in float or int (depending upon input operands or 2nd argument).Implementation cases in pow() functionThe below table summarizes the different cases to apply the Python pow() function.Cases of Python pow() functionExamples of pow() functionExample 1: In this example, we are using the third argument in the pow() function, which performs a modulus operation after calculating the power. Python print(pow(3, 4, 10)) Output1 Explanation: print(pow(3, 4, 10)) calculates 34 mod 10. First 34=81, then finds the remainder when 81 is divided by 10, which is 1.Example 2: In this example, we use the pow() function to demonstrate how it handles different combinations of positive and negative bases and exponents, resulting in varying outputs based on their signs. Python # +x, +y print(pow(4, 3)) # -x, +y print(pow(-4, 3)) # +x, -y print(pow(4, -3)) # -x, -y print(pow(-4, -3)) Output64 -64 0.015625 -0.015625 Explanation:pow(4, 3) calculates 43=64, where both the base and exponent are positive.pow(-4, 3) calculates (−4)3=-64, where the base is negative and the exponent is positive.pow(4, -3) computes 1/43= 0.015625, where the base is positive and the exponent is negative.pow(-4, -3) calculates 1/(−4)3= -0.015625, where both the base and exponent are negative. Comment More infoAdvertise with us Next Article pow() Function - Python M manjeet_04 Follow Improve Article Tags : Python Practice Tags : python Similar Reads Python hash() method Python hash() function is a built-in function and returns the hash value of an object if it has one. The hash value is an integer that is used to quickly compare dictionary keys while looking at a dictionary.Python hash() function SyntaxSyntax : hash(obj)Parameters : obj : The object which we need t 6 min read hex() function in Python hex() function in Python is used to convert an integer to its hexadecimal equivalent. It takes an integer as input and returns a string representing the number in hexadecimal format, starting with "0x" to indicate that it's in base-16. Example:Pythona = 255 res = hex(a) print(res)Output0xff Explanat 2 min read id() function in Python In Python, id() function is a built-in function that returns the unique identifier of an object. The identifier is an integer, which represents the memory address of the object. The id() function is commonly used to check if two variables or objects refer to the same memory location. Python id() Fun 3 min read Python 3 - input() function In Python, we use the input() function to take input from the user. Whatever you enter as input, the input function converts it into a string. If you enter an integer value still input() function converts it into a string.Python input() Function SyntaxSyntax: input(prompt)Parameter:Prompt: (optional 3 min read Python int() Function The Python int() function converts a given object to an integer or converts a decimal (floating-point) number to its integer part by truncating the fractional part.Example:In this example, we passed a string as an argument to the int() function and printed it.Pythonage = "21" print("age =", int(age) 3 min read Python len() Function The len() function in Python is used to get the number of items in an object. It is most commonly used with strings, lists, tuples, dictionaries and other iterable or container types. It returns an integer value representing the length or the number of elements. Example:Pythons = "GeeksforGeeks" # G 2 min read Python map() function The map() function is used to apply a given function to every item of an iterable, such as a list or tuple, and returns a map object (which is an iterator). Let's start with a simple example of using map() to convert a list of strings into a list of integers.Pythons = ['1', '2', '3', '4'] res = map( 4 min read Python - max() function Python max() function returns the largest item in an iterable or the largest of two or more arguments. It has two forms. max() function with objectsmax() function with iterablePython max() function With ObjectsUnlike the max() function of C/C++, the max() function in Python can take any type of obje 4 min read memoryview() in Python The memoryview() function in Python is used to create a memory view object that allows us to access and manipulate the internal data of an object without copying it. This is particularly useful for handling large datasets efficiently because it avoids the overhead of copying data. A memory view obje 5 min read Python min() Function Python min() function returns the smallest value from a set of values or the smallest item in an iterable passed as its parameter. It's useful when you need to quickly determine the minimum value from a group of numbers or objects. For example:Pythona = [23,25,65,21,98] print(min(a)) b = ["banana", 4 min read Like