In python, how // and % used in mathematical problems? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

In python, how // and % used in mathematical problems?

I'm a python learner. It is very important for me to know me about these symbols. Please tell me about these as soon as possible.

13th Dec 2022, 6:26 AM
Dibakar Acharjee
Dibakar Acharjee - avatar
6 Answers
+ 3
To check how many times a number fits into another number: 11//4 #4+4=8 If we add 4 again, we get a number greater than 11. So 4 goes into 11 twice.
13th Dec 2022, 6:32 AM
Knight
Knight - avatar
+ 7
Dibakar Acharjee , since you have started with sololearn just a few days ago, it is recommended to start learning from the *python for beginner* tutorial. https://www.sololearn.com/Course/Python-for-Beginners/?ref=app additional: here is a link to a short tutorial about the use of "//" (floor division) and "%" (modulo division): https://www.sololearn.com/learn/Python/4430/?ref=app
13th Dec 2022, 7:23 AM
Lothar
Lothar - avatar
+ 2
# Hi, Dibakar Acharjee ! # Here's an example:' t = 128 # Minutes. print(f"{t} minutes = {t//60} hours and {t%60} minutes.")
13th Dec 2022, 6:50 AM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Thanks, everyone. My confusion is now clear.
13th Dec 2022, 1:30 PM
Dibakar Acharjee
Dibakar Acharjee - avatar
0
What about %
13th Dec 2022, 6:34 AM
Dibakar Acharjee
Dibakar Acharjee - avatar
0
Ouch. Sorry. Showing the same example: Four fits into 11 twice, forming the closest possible number - 8. Calculating 11-8 we get three. Three will be the remainder of the division. that is, the % sign finds the remainder of the division
13th Dec 2022, 6:38 AM
Knight
Knight - avatar