At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Hoot! You just asked your first question! Hang tight while I find people to answer it for you. You can thank people who give you good answers by clicking the 'Good Answer' button on the right!
can you please put the rest of the while loop and I'll try to answer
>>> y=0 >>> x=3 >>> itersLeft = x >>> while(itersLeft>0): y=y+x itersLeft=itersLeft-1 print y SyntaxError: invalid syntax
I think because you haven't indented it correctly. the line y = y + x should be tabbed in also the next one
Hmm. on my screen in Python, those two lines are indented, but after copying them into the chat box, they are no longer indented...
I'm not sure, when I run it, it comes up with 9
That's strange. I guess I'll just keep trying. Thanks for your help Joz!
are you sure they are not in line with while? I'm just saying, because the print y is further left on the chat box
in my python interface, "y=y+x" and "itersLeft = itersLeft - 1" are both indented to the right of the "while" statement. "print y" is to the left of the while statement
yeah, that sounds right to me. When it comes up with the error, is there a pink thing on the script part?
This is basically my first time programming, so I'm not exactly sure what you mean by script. "print" is highlighted in pink, and below that it says "SyntaxError: invalid syntax"
hmmm... try lining it all on the left hand side, except the 2 lines under while. Failing that, I don't know.
ok i'll give that a shot. my last question for you - how do i line everything up on the left side? every type i start a line, it starts with ">>>"
wait... are you doing it straight into the shell?
try to find the IDLE page. give me a minute and I'll tell you the path to find it...
well, i feel like an idiot. As I was watching the video lecture, I noticed my screen looked different, but I ignored it. You're right, the top of my screen says "Python Shell"
is it a white screen, yeah? (Don't worry, I did the same)
just go to file, new window. If you don't have an option bar on the top, let me know
ahh - that gave me a blank screen. i typed in the code, saved, and clicked "run module" and that gave me the right output for y (9). Thank you so much for walking me through this
Haha no worries, you are set up now...
also make sure when you save, you save as name.py
ok got it. thanks again...