Python division

前端 未结 12 1033
挽巷
挽巷 2020-11-21 06:23

I was trying to normalize a set of numbers from -100 to 0 to a range of 10-100 and was having problems only to notice that even with no variables at all, this does not evalu

12条回答
  •  春和景丽
    2020-11-21 06:56

    Specifying a float by placing a '.' after the number will also cause it to default to float.

    >>> 1 / 2
    0
    
    >>> 1. / 2.
    0.5
    

提交回复
热议问题