I'm just starting to learn python and I'm using a textbook to learn. For demonstrating for loops the book used this bit of code:
I understand it for the most part except for the + operators in front of and behind of str(i). I know what they are, but for some reason I'm having a hard time figuring out why they are both needed in that bit of code. The textbook isn't explaining it.
1 2 3 |
print ( 'My name is' ) for i in range ( 5 ): print ( 'Jimmy Five Times (' + str (i) + ')' ) |
buran write Jan-25-2021, 06:50 PM:
OP figured it out and removed the text, but i restored the original content
OP figured it out and removed the text, but i restored the original content
buran write Jan-25-2021, 06:49 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.