Question about STRINGS & CONSOLE OUTPUT


#1

Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

day = 6
print “03 - %s - 2019” % (day)
03 - 6 - 2019
print “03 - %02d - 2019” % (day)
03 - 06 - 2019

Please explain d in line 4 more.I am quite not sure what it means and how it functions.Thanks!:grinning:

Strings and Console Output


#2

%d acts as a placeholder for numbers, just like %s is a placeholder for strings. Its a useful way to insert variables into a string


#3

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