Python iter() Function26 Sept 2024 | 1 min read The python iter() function is used to return an iterator object. It creates an object which can be iterated one element at a time. SignatureParametersobject: An iterable object. sentinel (optional)- It is a special value that represents the end of a sequence. ReturnIt returns an iterator object. Python iter() Function Example 1The below example shows the working of iter(). Output: 1 2 3 4 5 Explanation: In the above example, iter() function converts an list iterable to an iterator. Next TopicPython Functions |
Function The python ord() function returns an integer representing Unicode code point for the given Unicode character. Signature ord(character) Parameters character: A character string of length 1. Return It returns an integer that represents Unicode code point for the given Unicode character. Function Example 1 The below example shows the working of...
1 min read
Function function is used to check whether the given object is an instance of that class. If the object belongs to the class, it returns True. Otherwise returns False. It also returns true if the class is a subclass. The isinstance() function takes two arguments object...
3 min read
Function function is used to get remainder and quotient of two numbers. This function takes two numeric arguments and returns a tuple. Both arguments are required and numeric. This function has the following syntax. Signature divmod (number1, number2) Parameters number1: A numeric value, it is required. number2: A numeric value,...
1 min read
Function function is used to create a tuple object. Signature tuple(iterable) Parameters Iterable: It is a sequence, collection, or an iterator object. Return It returns a tuple. Function Example 1 The below example creates tuple using tuple(). t1 = tuple() print('t1=', t1) # creating a tuple from a list t2 = tuple([1, 6, 9]) print('t2=',...
1 min read
Function Python has() function is used to get the hash value of an object. Python calculates the hash value by using the hash algorithm. The hash values are integers an used to compare dictionary keys during a dictionary lookup. We can hash only these types: Hashable types:...
2 min read
Function Python is a flexible programming language with a vast library of functions that can make coding a lot more straightforward. Quite possibly of the most remarkable and frequently used function in Python is the eval() function. In this article, we will examine the eval() function...
3 min read
Function function is used to get the integer value. It returns an expression converted into an integer number. If the argument is a floating point, the conversion truncates the number. If the argument is outside the integer range, It converts the number into long type. If...
2 min read
Function The python bin() function is used to return the binary representation of a specified integer. A result always starts with the prefix 0b. Signature bin(n) Parameters n - An integer Return It returns the binary representation of a specified integer. Function Example 1 x = 10 y = bin(x) print (y) Output: 0b1010 Note: The...
1 min read
Function function is used to delete an attribute from a class. It takes two parameters first is an object of the class and second is an attribute which we want to delete. After deleting the attribute, it no longer available in the class and throws...
1 min read
Function The python open() function opens the file and returns a corresponding file object. Signature open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Parameters file: It is a path like object giving the pathname of the file to be opened. mode (optional): It specifies the mode in which the file is...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India