Skip to content

int

Syntax

int(x)

Parameters

x
An expression that evaluates to a numeric value.

Returns

Returns the integer part of a numerical value.

Description

This action returns the integer part of a numeric value. In other words, int(x) returns floor(x) if x is non-negative and ceil(x) if x is negative.

Examples

For some numeric variable my_variable:

my_variable = int(3.7)  # my_variable = 3
my_variable = int(-3.7) # my_variable = -3

See Also