Python round() Function26 Sept 2024 | 1 min read Python round() function rounds off the digits of a number and returns the floating-point number. SignatureParametersnumber : The number that is to be rounded. digits : It is the number for which the given number is to be rounded, and it is an optional parameter. ReturnIt rounds-off a number and returns the value as output. Let's see some examples of round() function which are given below: Python round() Function Example 1This example shows working of the round() function in Python: Output: 10 11 7 Python round() Function Example 2This example shows round-off a number to given n digits places: Output: 2.67 2.67 Next TopicPython Built in Functions |
Python format()
Function The python format() function returns a formatted representation of the given value. Signature format(value, format) Parameters value: It is the value that needs to be formatted. format: It is the specification on how the value should be formatted. Return It returns a formatted representation of the given value. Function Example 1 The...
1 min read
Python list()
Function The python list() creates a list in python. Signature list(iterable) Parameters iterable (optional) - An object that can be a sequence( string, tuple etc.) or collection( set, dictionary etc.) or iterator object. Return It returns a list. Function Example 1 The below example create a list from sequence: string, tuple and list. #...
1 min read
Python bytearray()
Function The python bytearray() function returns a bytearray object and can convert objects into bytearray objects, or create an empty bytearray object of the specified size. Signature bytearray(x, encoding, error) Parameters x (optional) : It is the source that initializes the array of bytes. encoding (optional) : It is an...
1 min read
Python ascii()
Function The python ascii() function returns a string containing a printable representation of an object and escapes the non-ASCII characters in the string using \x, \u or \U escapes. Signature ascii(object) Parameters object: It takes an object like strings, list etc. Return It returns a readable version of an object and replaces...
1 min read
Python iter()
Function The python iter() function is used to return an iterator object. It creates an object which can be iterated one element at a time. Signature iter(object, sentinel) Parameters object: An iterable object. sentinel (optional)- It is a special value that represents the end of a sequence. Return It returns an iterator object. ...
1 min read
Python exec()
Function The python exec() function is used for the dynamic execution of Python program which can either be a string or object code and it accepts large blocks of code, unlike the eval() function which only accepts a single expression. Signature exec(object, globals, locals) Parameters object - It should be...
1 min read
Python input()
Function function is used to get input from the user. It prompts for the user input and reads a line. After reading data, it converts it into a string and returns that. It throws an error EOFError if EOF is read. Signature input ([prompt]) Parameters prompt: It is a...
1 min read
Python dir()
Function function returns the list of names in the current local scope. If the object on which method is called has a method named __dir__(), this method will be called and must return the list of attributes. It takes a single object type argument....
2 min read
Python bytes()
Function The python bytes() function in Python is used for returning a bytes object. It is an immutable version of bytearray() function. It can create empty bytes object of the specified size. Signature bytes(source) bytes(encoding) bytes(error) Parameters source is used to initialize the bytes object. It is an optional parameter. encoding is optional unless...
1 min read
Python range()
Function Python, one of the most famous programming languages, offers a scope of inherent capabilities that improve on different undertakings. The range() function stands out as a versatile instrument for iteration and sequence creation. We will look the syntax, parameters, and practical applications of the range()...
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