Python - int() function

PythonServer Side ProgrammingProgramming

Python int() function converts the specified value into an integer number.

The int() function will returns an integer object constructed from a number or string let say x, or return 0 if no argum ents are specified.

Syntax

int(value, base)
int(x, base=10)

value = A number or a string that can be converted into an integer number

base = A number representing the number format. Default value − 10

Example

# int() for integers
int(10)
10
int(20)
20
# int() for floating point numbers
int(11.2)
11
int(9.9e5)
990000
raja
Published on 16-May-2020 14:13:43
Advertisements