Sfoglia il codice sorgente

Use integer division instead of float division + truncation

taddeus 6 anni fa
parent
commit
c1c2bf81cd
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      2019/01_fuel.py

+ 1 - 1
2019/01_fuel.py

@@ -2,7 +2,7 @@
 import sys
 
 def fuel(mass):
-    return int(mass / 3) - 2
+    return mass // 3 - 2
 
 def fuelrec(mass):
     f = fuel(mass)