My code works, but I am wondering why we use %d to hold the place of the values we want to print in the string when we have been taught to use %s.
When I change them all to %s, it still works. When I change only one to %s, it still works.
I would think that good practice would be to pick letters that make sense, in this case, maybe b for base, e for exponent, and r for result: "%b to the power of %e is %r." But that doesn't work; I get a syntax error: "ValueError: unsupported format character 'b' (0x62) at index 1" Apparently we can use d and s but not b.
So my real question is how do we pick what letter to use?
def power(base, exponent): # Add your parameters here! result = base**exponent print "%d to the power of %d is %d." % (base, exponent, result) power(37, 4) # Add your arguments here!