+ 1
Python output float / integer
x = 2 x \=2 print(x) Gives output 1.0 and if we want output 1 then why can't we do like x = 2 x\\=2 print(x)
2 Réponses
+ 7
You can do so. But if
x = 3
x /= 2
>>>>1.5
x = 3
x //= 2
>>>>1
+ 4
You might be confusing '\' for '/'.
Both /= and //= operators work as intended.
x = 2
x //= 2
print(x)
will give you an output of 1.