d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Very Simple Python Expresion
Add Reply New Topic New Poll
Member
Posts: 19,894
Joined: Oct 28 2008
Gold: 1,317.96
Sep 19 2018 06:48pm
Write a Boolean expression that checks whether the result of dividing 100 by 4 is an even number. Has to be one expression only.
Member
Posts: 12,247
Joined: Mar 30 2011
Gold: 1,825.00
Sep 19 2018 09:45pm
not working for me... ill keep trying

This post was edited by Fyasko on Sep 19 2018 09:51pm
Member
Posts: 19,894
Joined: Oct 28 2008
Gold: 1,317.96
Sep 19 2018 09:52pm
i was overthinking it...

(100//4) % 2 == 0
Member
Posts: 16,662
Joined: Nov 24 2007
Gold: 15,245.00
Trader: Trusted
Sep 20 2018 09:27am
Quote (zeja @ Sep 20 2018 04:52am)
i was overthinking it...

(100//4) % 2 == 0


Yes.

This is somehow assuming that 100 / 4 is an integer in the first place...
Under that assumption, you could as well write :

int(100/4) % 2 == 0
Member
Posts: 3,417
Joined: May 15 2009
Gold: 1,201.69
Sep 24 2018 02:37am
Quote (zeja @ 19 Sep 2018 20:52)
i was overthinking it...

(100//4) % 2 == 0


only after you thought about it for a minimum of 3 hours though
Member
Posts: 35,447
Joined: Jan 25 2009
Gold: 1,173.00
Sep 29 2018 01:57am
Quote (marioo1182 @ 24 Sep 2018 03:37)
only after you thought about it for a minimum of 3 hours though


Yes but he successfully answered his own question so there is joy in that!
Go Back To Homework Help Topic List
Add Reply New Topic New Poll