+ 2

What does the % sign do in python

I understand that if you say something like this print(26%5) the output would be 1 because it does the remainder. But all too often I see it used for something else and I'm clueless as of what it means. Like people use it like this sometimes print(%s + "Something else") I don't even know if the syntax was correct there.

3rd Nov 2017, 1:23 AM
Darth Vador
Darth Vador - avatar
1 Answer
+ 9
In that case that is "format form" in this code %s will be replaced by inp value inp=str(input()) print("%s,man"%inp)
3rd Nov 2017, 1:38 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar