help with %! PY :( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help with %! PY :(

i know it’s a dumb question but when you’re solving a problem, in what context you realize you need to use modulus operator? i’m having troubles with it and it’s driving me CRAZY. (sorry if i wrote something wrong but english it’s not my native language)

1st May 2021, 9:11 PM
Mash Rykova
3 Answers
+ 1
Hi! The operator of the remainder of the number % (for example: 17 % 3 = 2) 1. Take the nearest number when divided by 3 would be zero. That's apparently 15 2. Subtract 15 from 17 and the result is your answer. ...If you find it difficult to explain yourself in English - ask in Russian, some users use translators and will be able to answer you in Russian, but the percentage of answers will be less
2nd May 2021, 12:33 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Hi! You will need the modulo operator, for example when you want to find out if a number is a odd or even number, when a number is a divisor to another number, or if a year is a leap year, or not.
2nd Jul 2021, 10:10 PM
Per Bratthammar
Per Bratthammar - avatar
0
Для большего понимания этого оператора вот 3 задачи из курса по питону, где он используется/может использоваться: Остаток от деления Учебники для учеников Выражение elif V Учитывая четность Fizz Buzz на степике есть хороший курс по питону, где этому оператору тоже уделяется внимание и есть задачи для практики
2nd May 2021, 1:00 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar