TKA
TKA

Reputation: 51

String formatting error with operators in python

Using Python string formatting, my expected output is:

If you took 19 and 13 and added them, you would get 22

However not quite sure if I have done it properly. I keep getting this error:

 Not all arguments converted during string formatting

Could you help please?

Code:

my_age = 19
teenager = 13

print "If you took %s and %s and added them, then you will get %" %(my_age,teenager,my_age + teenager)

Upvotes: 0

Views: 45

Answers (1)

CRABOLO
CRABOLO

Reputation: 8793

You're just missing the last 's' after the last % in string

print "If you took %s and %s and added them, then you will get %s" %(my_age,teenager,my_age + teenager)

Upvotes: 1

Related Questions