I'm running through the Python intro for fun as well. My programming experience is limited to HTML, Coldfusion, PHP, and SQL, so this question might be stupid for people who have worked with C.
Question - the following lines are from one of the first pages of the tutorial.
Code:
>>> word = 'Help' + 'A'
>>> word
'HelpA'
>>> '<' + word*5 + '>'
''
Why does the last line have to have the " + "'s around word*5 to work?
Code:
>>> word*5
'HelpAHelpAHelpAHelpAHelpA'
>>> ''
''
>>> '<'word*5'>'
SyntaxError: invalid syntax (, line 1)
... even with the code tag it's still omitting some.
An Informal Introduction to Python — Python v3.1a0 documentation
That's the page, it's like halfway down, section on concatenates.
Don't understand why '<' + word*5 + '>' works but '<'word*5'>' does not.