Why did the video use %s over %d


#1

Hello,

I got the program to work with the help of the video but:

I used %d in my program when calling on the area and the other inputs but i got incorrect answers for the area but the base, height, and radius came out fine. The video used %s instead. I asked a similar question earlier here : Using %02d instead of %02s. I was informed that the %d means decimal and the %s is for string so I assumed that I would use %d since I am using numbers here.

Thank you!


#2
>>> print ("%02s" % 4)
 4
>>> 

Note that the zero lead padding is not in effect on a string, but there is a leading space.

>>> print ("%4s" % 4)
   4
>>> 

#3

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