Use of %


#1

why % before total is used in print("%.2f" % total")


#2

its python syntax, %f is a placeholder for a float number. just like %s is a string placeholder to insert variables into a string


#3

i am asking about the % used before total


#4

another part of python syntax, the % tells python we are now going to supply the variable we promised in the string.


#5

is it like , used in c for differentiating a variable and a statement


#6

Does it matter? Its part of the python syntax, if you want to know how its interpreted by the underlying C code, you will first have to learn C. I wouldn’t focus too much on this yet, to get to this point with computers that we currently are, have taken million of man hours

we are standing on the shoulder of giants, sometimes, certain things have to just be accepted, you can get into more depth later


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.