Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 23 Online
OpenStudy (anonymous):

In chapter one of the reading it says to create a file under latoya.py that says "print 1+1". It then says to type "$ python latoya.p" into the command line and I'll get 2. When I do that it just says I have a syntax error. What am I doing wrong?

OpenStudy (anonymous):

Hi, I can not say something without looking at the code, but I'd recommend checking your code carefully, also I think it'll be "$ python latoya.py", seems like you have forgotten the "y" at the end, I hope I can be help

OpenStudy (anonymous):

Are you reading the Input/Output? I remember I didn't understand that either and got errors as well. I'm also curious if someone can answer, although at this point I have had no use for it. Definately there should be a y at the end as bogace said.

OpenStudy (anonymous):

the dollar sign is the command prompt for the shell the author is using. for example, in a dos window my command prompt is c:\Python27> ..... (NOT $ as shown in the reading). If i type python latoya.py, at the command prompt then it does print 2 to the screen. I have to be 'in' the directory that the file, latoya.py, is in for this to work.

OpenStudy (anonymous):

I still can't get this to work.. the error appears to have something to do with the colon :

OpenStudy (anonymous):

there shouldn't be a colon in the file. at the command prompt type python latoya.py no colons

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!