☰
d2jsp
Rules
Help
Forum Gold FAQ
Live Streams
Photo Gallery
Hourly Raffle
Ladder Slasher
Log In
Register
Log In
Register
Account Recovery
Resend Validation Email
d2jsp Forums
>
Off-Topic
>
General Chat
>
Homework Help
> Very Simple Python Expresion
Add Reply
New Topic
New Poll
Views: 297
Replies: 5
Track Topic
zeja
Member
Posts: 19,894
Joined: Oct 28 2008
Gold
:
1,317.96
#1
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.
Fyasko
Member
Posts: 12,247
Joined: Mar 30 2011
Gold
:
1,825.00
#2
Sep 19 2018 09:45pm
not working for me... ill keep trying
This post was edited by Fyasko on Sep 19 2018 09:51pm
zeja
Member
Posts: 19,894
Joined: Oct 28 2008
Gold
:
1,317.96
#3
Sep 19 2018 09:52pm
i was overthinking it...
(100//4) % 2 == 0
feanur
Member
Posts: 16,662
Joined: Nov 24 2007
Gold
:
15,245.00
Trader:
Trusted
#4
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
marioo1182
Member
Posts: 3,417
Joined: May 15 2009
Gold
:
1,201.69
#5
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
NinjaSushi
Member
Posts: 35,447
Joined: Jan 25 2009
Gold
:
1,173.00
#6
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
© 2003-2024 d2jsp
Contact