If I have a sentence like this:
"I now have a total of % yellow bananas!"
but I need it to change the number 2 to a 3, print, then a 4, print, etc until it reaches a set number like 10, how can I go about that?
Expand|Select|Wrap|Line Numbers
- sentence = "I now have a total of % yellow bananas!"
- for i in range(2,11):
- print sentence %i
ValueError: unsupported format character 'y' (0x79) at index 9
When I try it with a different sentence:
Expand|Select|Wrap|Line Numbers
- sentence = " I have % dogs!"
- for i in range(2,11):
- print sentence %i
I have 2ogs!
I have 3ogs!
I have 4ogs!
I have 5ogs!
I have 6ogs!
I have 7ogs!
I have 8ogs!
I have 9ogs!
I have 10ogs!