How to truncate float in Python

1 Answer

0 votes
print(round(4478.123789, 4))
print(round(127.50, 4))
print(round(127.51, 4))


    
    

'''
run:

4478.1238
127.5
127.51

'''

 



answered Apr 26, 2021 by avibootz

Related questions

...