Lesson 1 go with the flow


#1

LESSON 1.GO WITH THE FLOW

<In what way does your code behave incorrectly? Include ALL error messages.>

INVALYD SYNTAX

Why I cant run this code in my python 3.6.3


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

Python 3.6.3 gives you an INCREDIBLY detailed explanation about why if you run this.

Or at least mine does.

→ python --version
Python 3.6.3
→ python aoeu.py
  File "aoeu.py", line 2
    print "You've just entered the clinic!"
                                          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "You've just entered the clinic!")?

…Its suggestion isn’t valid syntax either though, strange that there’s an int in there… oh well.


#3

because in python3, print is a function call and not a statement. Given its a function call, it requires parentheses


#5

Funny. The “int” is print
They had just stripped off the leading 6 characters (intended to be "print ")
And because it was indented by 4 spaces, they stripped off 4 characters too few, so now "int " was included.
https://bugs.python.org/issue32028


#6

How can I get an error message on “Conditionals” lesson 1? It just says click Run. Error I get says

“Traceback (most recent call last):
File “python”, line 13, in
NameError: name ‘r’ is not defined”


#7

In python 3.6.3, following changes are there:-

  1. () is used when using print
  2. instead of raw_input, use only input command

i think it will solve ur problem


#8

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