Have been trying to follow a python tutorial in the Full Circle magazine and consistently fail?
I typed the following into my text editor "gedit"
Code:
#! /usr/bin/env python
DaysInMonth =
[31,28,31,30,31,30,31,31,30,31,30,31]
print DaysInMonth[6] (for July)
I saved the above as daysinmonth.py in my python_examples directory. I then opened a terminal and navigated to the python_examples directory and typed;
Code:
chmod +x daysinmonth.py
Finally, still in the terminal i typed python ~/python_examples/daysinmonth.py and the output was:
Code:
frump@ubuntu-linux-uk:~$ python ~/python_examples/daysinmonth.py
File "/home/frump/python_examples/daysinmonth.py", line 3
DaysInMonth =
^
SyntaxError: invalid syntax
frump@ubuntu-linux-uk:~$
Would someone please tell me what i am doing wrong.