In the future, don't post code like that that you know doesn't run without saying so. You should have said that you were getting a syntax error, and if your IDE is any good, you should have known and said what line. (You very well may not be using a good IDE, which I don't blame you for, but consider changing.)
Due to the reasons discussed here
we will be moving to python-forum.io
on October 1, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.