How can i do a maths operation? Like the description. And i don't understand the "%" concept. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i do a maths operation? Like the description. And i don't understand the "%" concept.

i dont know how to do maths operations like "2+4" "7/3". pls examples. thanks :))!!

9th Apr 2018, 9:57 AM
Hector Lapaz Sanchis
Hector Lapaz Sanchis - avatar
4 Answers
+ 11
#its very simple you'll find! print(2+4) print(7/3) print(2%4) # and % is the remainder of division of two numbers. inside a string it can do other things, but that's unrelated to your question
9th Apr 2018, 10:08 AM
Ahri Fox
Ahri Fox - avatar
+ 2
4+2 = 6 (Normal adding process) 7/3 = 2.333333333... (Normal Division process) If we divide 1.25 by .5 than, we can write: 1.25= .5*2(here .5*2=1)+.25 (here .25 is remainder, here further division approaches not followed as normal mathematical process follows, in normal mathematical process, we can write 1.25/.5 = 2.5) hence, 1.25 divided by .5, quotient is 2 and .25 isn't divided by .5 so it is remainder. above term is expressed by modulus sign (%),where % shows only remainder,not shows quotient. it is expressed by 5%2 = 1 11%4 = 3 5%3 = 2 3%5 = 3 6%5 = 1 12%7 = 5 2%2 = 0 1.25%.5 = .25
9th Apr 2018, 11:43 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
9th Apr 2018, 10:25 AM
cyk
cyk - avatar
+ 1
Ok thank you very much!!!! You're the best.
9th Apr 2018, 10:25 AM
Hector Lapaz Sanchis
Hector Lapaz Sanchis - avatar