+ 5
Phyton challenge
What is the output of this code? a = abs(-87) a=(a+3)%8; print(a) Can anyone explain about this?
50 Antworten
+ 11
Abs of -87 is 87 a=87
a+3= 90
90%8 = 2
+ 11
Now this is really starting to drive me crazy 😜 Why are so many people (not to mention any names Jasurbek Abdijalilov Sobirjon o'g'li Alexander Genereaux Techno Reda ) posting the same answer hours and hours and hours after someone else already posted it? 🤔
Don't get me wrong - it's great that you are participating and helping! Just strange that you didn't see the other posts....
Did you think the request for help was a coding challenge?
P.S. if you really want to help, rather than just posting the output of the code, also give an explanation, which was asked for 🙂
+ 10
David Ashton
The sad truth:
For some, it is more important to show that they know the answer than to help the questioner.
Sometimes we should hold back our own ego a little.
+ 9
Why are so many people (not to mention any names Reda Pankaj Kumar Ray saimanasa bandaru Rohith Jakkani ) posting the same answer hours and hours after someone else already posted it? 🤔
Don't get me wrong - it's great that you are participating and helping! Just strange that you didn't see the other posts....
P.S. if you really want to help, rather than just posting the output of the code, also give an explanation, which was asked for 🙂
+ 6
Giovanni Reale you, too, get 10/10 for good intentions but 2/10 for powers of observation since the answer 2 was posted 12 hours before you did 🤣
+ 6
Inglés:
Absolute of -87 is 87. So a=87
a=(87+3)%8
a= 90%8
8*11=88. 90-88=2=a
a=2
Español:
Valor absoluto de -87 es 87. Entonces a=87
a=(87+3)%8
a= 90%8
8*11=88. 90-88=2=a
a=2
+ 5
Meehzam 2
+ 4
Can you explain it with the simple and understandable way? 🙂
+ 4
Oh I think I get it, what is the meaning of this abs?
+ 4
Absolute value
+ 4
Some people say that abs are the muscles near your waist but I get no Google results for Phyton.
+ 4
a = abs(-87) => 87
a=(a+3)%8; => 87+3 =90
print(a) => 90%8 = 2
---------------------
+ 4
I guess that from this point it's just spam...
+ 3
2
+ 3
Abs means that you negative number will turns positive. Then add the a value with 3. Then computer will find the a value remainder
+ 3
a = abs(-87) #a=87
a=(a+3)%8; #a=(87+3)%8=90%8=2
print(a) # the printed value is 2
+ 3
Btw thanks all for the information you gave 😊
+ 3
|-87| = 87
87 + 3 = 90
90/8 --> remainder = 2
+ 2
Ohh okayy thanks for the information 😊