+ 1

% in Python

what dose this mean in Python : if x%2 == : print ("yes") else : print ("no") what would happen if I change the first line into ( if x%3 == ) , or it isn't valid ? and thank you ~

31st Dec 2023, 12:34 PM
Ãso
Ãso - avatar
2 Respostas
+ 2
Ãso , You know, questions like, "what would happen if I change the first line into ( if x%3 == )" are easily answered by trying it yourself in the playground. Here's a usage of that though. https://sololearn.com/compiler-playground/c4XaSiliW1zr/?ref=app
31st Dec 2023, 9:08 PM
Rain
Rain - avatar
+ 10
`%` is used to return the remainder of any division. Example:- 8%3 = 2. As 2 will be remainder if we divide 8 by 3.
31st Dec 2023, 12:39 PM
Gulshan Mahawar
Gulshan Mahawar - avatar