what is this symbol -> (%) for in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is this symbol -> (%) for in python?

And, could you please give me an example :)

19th Jul 2020, 10:13 AM
Givantaro Coding
Givantaro Coding - avatar
5 Answers
+ 7
% symbol stands for modulus For eg 7%3 3 | 7 | 2 - 6 --------------- 1 --------------- Your remainder is 1. So the final answer is 1 Because 1 is left when we divided 7 by 3
19th Jul 2020, 10:22 AM
Nilesh
+ 1
This symbol is used to get the remainder when a number divides by another. Input: print(5%3) Output: 2 Because 2 is left remainder on dividing 5 by 3
19th Jul 2020, 10:19 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
NiLesh[📴] thanks! I got it now! It's very helpful! ☺👍
19th Jul 2020, 7:06 PM
Givantaro Coding
Givantaro Coding - avatar
+ 1
AKSHAY thanks! It's very helpful! ☺👍
19th Jul 2020, 7:07 PM
Givantaro Coding
Givantaro Coding - avatar
+ 1
Jan Markus Thank you! Gonna check that link! ☺👍
19th Jul 2020, 7:07 PM
Givantaro Coding
Givantaro Coding - avatar