trunc(): integer part of a number


Youtube Live session on Tkinter

trunc() function returns integer part of a number .
Here are some examples with different type of numbers.
import math
print(math.trunc(34.56))   # 34
print(math.trunc(34.21))   # 34
print(math.trunc(34.99))   # 34
print(math.trunc(34))      # 34
Using negative number
import math
print(math.trunc(-34.11))   # -34
print(math.trunc(-34.99))   # -34
print(math.trunc(-34))      # -34
floor() & ceil() modf()
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer