What does the % sign mean in coding? [duplicate]

Like %i or %yellow? I'm not looking for it as an operator like 67%3. But like this:

print("pink is %i" %grade)

what does the above code mean?

2

1 Answer

It is used to format strings (you can read about string formatting in the string docs, also mentioned in Input and Output - old string formatting).

print("pink is %i" %10) 

Output

pink is 10

You Might Also Like