Python int() FunctionPython Functions

Difficulty Level:
Difficulty Level:

The int() function converts the given value into an integer number.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

print("int(1):  ", int(1))
print("int('11'):  ", int('11'))
print("int('2'):  ", int('2'))

Output:

int(1):   1
int('11'):   11
int('2'):   2

Syntax

int(x)

Parameters

x — A string or number.

Return Value

It returns an integer number.

Advertisement

© 2021 Pythonexample.org, all rights reserved. Privacy Policy | Contact Us