Quotient and remainder in python ex:20//6=3 while 20%6=2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Quotient and remainder in python ex:20//6=3 while 20%6=2

// = ONLY gives you NUMBER OF TIMES and ignores remainder. Example: print(20//6) = 3 % = Ignores the result and ONLY gives you the REMAINDER. Example: print(20%6) = 2

21st Sep 2017, 5:09 PM
SR7 zPROzEVERYTHING
SR7 zPROzEVERYTHING - avatar
6 Answers
+ 7
sorry i fixed everything first its python second its about quotient and remainder ok . 20÷6 if want it to make a code for it it will be ,print(20//6) because the dividing mark in python is / or // the difference is that the first one will produce a float(decimal) and the second willnot produce a float or a decimal . but it doesn't change the result . back to 20//6=3 cause 3×6=18 but there's a remainder which we can get it by doing this 20%6=2 which is the remainder. let's code it print (20÷6) wont work but print(20/6) will work and will produce you a float while this code print(20//6) won't produce a float to you . print (20//6) >>> 3 which is the number in an integer form . print(20/6) >>> 3.0 which is the number in decimal (float) form print (20%6) >>> 2 which is the remainder note don't put any quotes because they will print you the things that written inside them ex: print ('20//6) >>> 20//6 but if you will make it on your calculator it will be 3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333 a loop for ever
23rd Sep 2017, 6:42 AM
SR7 zPROzEVERYTHING
SR7 zPROzEVERYTHING - avatar
+ 4
This post is very confusing what language is this and what is the topic about add some tags and a (hope I don't sound rude) meaningful title
22nd Sep 2017, 9:15 PM
DeleteThisAccount
+ 1
thanks for your support I am now one of your followers
23rd Sep 2017, 6:47 AM
SR7 zPROzEVERYTHING
SR7 zPROzEVERYTHING - avatar
+ 1
thanq
30th May 2018, 5:07 AM
murali.ch
murali.ch - avatar
+ 1
I didn't understand please tell me clearly
4th Oct 2022, 3:24 PM
THULLURI LAKSHMI PRASANNA 4G2
THULLURI LAKSHMI PRASANNA 4G2 - avatar
0
Hlo anyone one please tell me clearly
4th Oct 2022, 3:25 PM
THULLURI LAKSHMI PRASANNA 4G2
THULLURI LAKSHMI PRASANNA 4G2 - avatar