"Simple Errors" - Course 8: Loops


#1

Okay, I’ve read all the other post on this and I honestly have no idea what the problem is. I even tested this personally on my Python IDLE and it worked - however it didn’t work on codecademy. Here’s my code:

choice = input("Enjoying the course?(y/n)")

while choice != 'y' and choice != 'n':  # Fill in the condition (before the colon)
  choice = input("Sorry, I didn't catch that. Enter again: ")

If anyone got any solution for this - I would greatly appreciate it.


#2

using input in python2 (codecademy) is a bad idea, the input will be evaluated as code, use raw_input, but this is currently also not working, see if you can do:

choice = raw_input("Enjoying the course?(y/n)")
choice = 'n'

while choice != 'y' and choice != 'n':  # Fill in the condition (before the colon)
  choice = input("Sorry, I didn't catch that. Enter again: ")

#3

oh it actually worked…

but why is that? The code that I’ve posted is the modified one that I’ve executed on python3. The one I’ve written in codecademy is exactly the same, except “input” gets turned to “raw_input”.

I don’t get this code, is mine suppose to work?


#4

it is suppose to work, but there are problem with raw_input at the moment, we are working on fixing it.


#5

ah alright, there seems to be a lot of bug in codecademy lately - just as the code failing to be compiled, hope you can get it fixed!


#6

yea, seems python course was pushed

python is an interpreted language, so compiling it is always going to be a bit tricky


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.