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

When I tried the codes from the end of Lecture about iteration, my Python 2.7 always can't identify the print command on the last line. Syntax error is always raised for print. I guess the system recognize the print itself as a variable. How can I resolve this? y = 0 x = 3 itersLeft = x while(itersLeft>0): y = y + x itersLeft=itersLeft-1 print y

OpenStudy (anonymous):

error attached here! Help please! thanks!

OpenStudy (anonymous):

worked for me - http://pastebin.com/UZRaY2c0

OpenStudy (anonymous):

hey i believe value of y is 9

OpenStudy (anonymous):

Yes the answer is 9. As it looks as if you were running this interactively you probably should have hit return again before you typed 'print y'. The code runs ok then. Hope this helps.

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!