Why using modulo?


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

Everything works in for me, yet i do not understand why we use modulo (%) operator in print part. Why do we add %s to string, and % between th string and variable?


for item in prices:
    print item
    print "price: %s" % prices[item]
    print "stock: %s" % stock[item]


#2

% special character has different meanings depending where used. when you use it between int variables it stands for modulo, but when you use it after print command - it refers to print syntax and in print syntax % stands for a variable you put after % to be placed in the string between ' ' .