help with %! PY :( | Sololearn: Learn to code for FREE!

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)

5/1/2021 9:11:16 PM

Mash Rykova

4 Answers

New Answer

+4

% returns the remainder of a division. You can use it if for example they are asking you what is left of distributing sweets among children or something like that. Also if they ask for time. If they give you for example 156 minutes and divide it between 60 you would have 2h but 36 minutes would be left, so that's what % do 156//60 = 2 156%60 = 36 So now you know 156 minutes are 2 hours 36 minutes. In conclusion whenever you need to know the remainder of any tipe of division % is the best option.

+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

+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.

0

Для большего понимания этого оператора вот 3 задачи из курса по питону, где он используется/может использоваться: Остаток от деления Учебники для учеников Выражение elif V Учитывая четность Fizz Buzz на степике есть хороший курс по питону, где этому оператору тоже уделяется внимание и есть задачи для практики