A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_math_trunc.asp below:

Website Navigation


Python math.trunc() Method

Python math.trunc() Method

❮ Math Methods

Example

Find the integer part of different numbers:

# Import math Library

import math

# Return the truncated integer parts of different numbers

print(math.trunc(2.77))

print(math.trunc(8.32))

print(math.trunc(-99.29))

Try it Yourself » Definition and Usage

The math.trunc() method returns the truncated integer part of a number.

Note: This method will NOT round the number up/down to the nearest integer, but simply remove the decimals.

Syntax Parameter Values Parameter Description x Required. The number you want to remove the decimal part of. If the value is not a number, it returns a TypeError Technical Details Return Value: An int value, representing the truncated integer parts of a number Python Version: 1.4

❮ Math Methods

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4