Taking the floor of a float

前端 未结 6 424
礼貌的吻别
礼貌的吻别 2021-02-01 13:21

I have found two ways of taking floors in Python:

3.1415 // 1

and

import math
math.floor(3.1415)

The problem

6条回答
  •  离开以前
    2021-02-01 13:57

    The second approach is the way to go, but there's a way to shorten it.

    from math import floor
    floor(3.1415)
    

提交回复
热议问题