Quote:
Originally Posted by jc.
The final line reads:
Code:
print('I don't like your color choice')
But this will generate:
Code:
SyntaxError: invalid syntax
|
You are quite right. It should be double quotes on the outside of the string.
Quote:
Originally Posted by jc.
Could someone explain how the tuple(?) is accessible within the if/elif chain, as it is not assigned to a variable? I'm presuming it is just witchcraft! Many thanks.
|
Hmm, I messed this one up didn't I?
The problem is that the first line should not have parens around the
variable names.
it should look more like
red,blue,green = range(3) # no parens.
If you'd asked this question last week I could have consulted the original source
code but sadly, while upgrading to Windows10 at the weekend, I managed to
wipe the drive with all the book source code! But certainly the code in
the manuscript includes parens. My bad!
sorry,
Alan G.