What is %f


is %f like %s only it uses a variable defined in a function?


Hi @cloudrunner24055,

%f is meant for floats and %s is used for strings. They're just different variables used for different datatypes.

print "hi %f" %("bob") #will NOT work because "bob" is a string not a float

print "hi %s" %("bob") #Correct way because "bob" is a string.

print "number %f"(5.0) #will work because '5.0' is a float.


In the Parameters and Arguments portion of the Functions lesson of the Python course, "%d" is used. Does this stand for integers? Are there any other "%'s"?

Should I have replied as a separate topic?