關於浮點數 | Sololearn: Learn to code for FREE!
+ 1

關於浮點數

如何強制轉換浮點數為整數?

13th Apr 2017, 2:15 AM
高偉益
高偉益 - avatar
2 Answers
+ 9
如果你有一個變量x,值為7.33,你可以這樣做 x = 7.33 x = int(x) print(x) Output:7
13th Apr 2017, 2:32 AM
MrCoder
MrCoder - avatar
+ 9
Just for public reference, this is a query to convert floating point values to integer.
13th Apr 2017, 5:22 AM
Hatsy Rei
Hatsy Rei - avatar