hello im doing intro to compsci (ocw scholar) and im having trouble with pset 1. why is python putting the while loop as a syntax error?
file is attached here
I don't see "while" in your code, but you need a colon at the end of the if statement. When you get a syntax error, python will position the cursor at the location of the error to give you a suggestion.
thanks i changed it before uploadin it, do you have any sugestions for the code? i can't seem to solve the problem, or make the program work for that matter
Hi, I've just started as well here (and I'm using Python 3). Couple things that caused problems for me: a) make sure you're typing the code in IDLE's edit window (as opposed to the shell window) b) the "while" statement requires certain formatting, ie, the loop that the "while" statement describes needs to be indented below the statement as shown in the examples.
hi, thank you for the advice, i already checked those and there doesn't seem to be a problem there, but instead i can't figure out what exactly is the syntax error i keep getting, could you help me with that?
I made changes and attached it. It seems that you're doing things out of order. I'm using Python 3 also.
You want the name of the variable you are identifying to be on the left of the '=' and the value you are setting the variable to on the right side. You had it written backwards.
Join our real-time social learning platform and learn together with your friends!