Do I need a ( ) for print and code not work on a real python?


#1



https://www.codecademy.com/en/courses/python-beginner-BxUFN/0/1?curriculum_id=4f89dab3d788890003000096


Traceback (most recent call last):
File "/Users/apple/Desktop/Ted.py", line 36, in
clinic()
File "/Users/apple/Desktop/Ted.py", line 27, in clinic
answer = raw_input("Type left or right and hit 'Enter'.").lower()
NameError: name 'raw_input' is not defined


Replace this line with your code. 
def clinic():
    print ("You've just entered the clinic!")
    print ("Do you take the door on the left or the right?")
    answer = raw_input("Type left or right and hit 'Enter'.").lower()
    if answer == "left" or answer == "l":
        print("This is the Verbal Abuse Room, you heap of parrot droppings!")
    elif answer == "right" or answer == "r":
        print ("Of course this is the Argument Room, I've told you that already!")
    else:
        print ("You didn't pick left or right! Try again.")
        clinic()

clinic()


#2

Since you are trying to test this on pyhon 3 (I assume) the input call was changed from raw_input() to just input() :grin:


#3

You DO need the parentheses for the print statement in the new version of Python. :slight_smile:


#4

You've just entered the clinic!
Do you take the door on the left or the right?
Traceback (most recent call last):
File "/Users/apple/Desktop/Ted.py", line 36, in
clinic()
File "/Users/apple/Desktop/Ted.py", line 27, in clinic
answer = leftinput("Type left or right and hit 'Enter'.").lower()
NameError: name 'leftinput' is not defined
Thanks a lot.

I still get error message.

another question: this is for Python 2? should I go back to python 2 to follow up codeacademy better?

Thank everyone again!


#5

Can I see your full code?


#6

Control Flow

def clinic():
print ("You've just entered the clinic!")
print ("Do you take the door on the left or the right?")
answer = leftinput("Type left or right and hit 'Enter'.").lower()
if answer == "left" or answer == "l":
print("This is the Verbal Abuse Room, you heap of parrot droppings!")
elif answer == "right" or answer == "r":
print ("Of course this is the Argument Room, I've told you that already!")
else:
print ("You didn't pick left or right! Try again.")
clinic()

clinic()


#7

You have left input there when it should be just input.


#8

Wow, thank you and thank you


#9

Welcome. Glad to help. :slight_smile:


#10

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