I am new to python and have looked at similar questions but none seems to offer a solution to my simple case so I suspect I have made a basic error. I am using Python 2.7 on a Mac and on Ubuntu running on a Chromebook. When the project is complete I shall transfer it to a Raspberry Pi.
This snippet of code runs without a problem if I invoke the interpreter with the python call and type in the code.
switch = (int(time.strftime("%M"))%2
WhichOne = "Right","Left"
usbname = WhichOne[switch]
However, when I run the script containing this code fragment by typing ./project20160218.py or python project20160218.py
I obtain
user@chrubuntu:~/Documents/Degree day project$ python project20160218.py
File "project20160218.py", line 23
WhichOne = "Right","Left"
^
SyntaxError: invalid syntax
I would be very grateful for some guidance here.
Thanks.