+ 1
How to get the rest of the division ?
#here was my first lesson a=7%(5//2) print (a) a=1 #here I got 2 (5/2=2.5), how to get the .5 rest? b=5//2 print(b) b=2 #here I got 1 (7/2=3.5), how to get the .5 rest? c=7%2 print(c) c=1
3 Réponses
+ 5
Joás Lima just a minor problem
Using a single slash to divide numbers produces a decimal (or float, as it is called in programming)👇
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2271/
and 👇this has examples too
https://www.programiz.com/python-programming/operators
atb 👍
edit: please be more specific
+ 3
You can do this:
==> (7/2) - (7-(7%2))/2
evaluation:
==> (3.5) - (7-(1))/2
==> 3.5 - (6)/2
==> 3.5 - 3
==> 0.5
+ 2
Thank you guys. but for what I see there isnt an unic operator to do that.
Jonathan Pizarra that great. O surely must do that way to get what I want.