What does %s and % do

for fruit in prices:

  print fruit
  print "price: %s" % prices[fruit]
  print "stock: %s" % stock[fruit]

What does %s and % do again, in this context? I forget.

Sorry if I posted this in the wrong place.

4 Likes

Go back and review Strings and Console Output for the subject of string formatting.

%s

is a string value placeholder,

% ()

is the argument list.

5 Likes

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