I can't seem to do this right 15/16 *Solved*


#1

This is my code:

name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")

print "Ah, so your name is %s, your quest is %s " \
"and your favorite color is %s." % (Name, nothing, blue)

What did I do wrong? (name is there for a reason)

This is what the code does:

What is your name? name
What is your quest? nothing
What is your favorite color? blue
Traceback (most recent call last):
File "python", line 6, in
NameError: name 'Name' is not defined

What did I do wrong?


#3

Oh ok so this is what you do:

name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")
name = "name"
quest = "nothing"
color = "blue"
print "Ah, so your name is %s, your quest is %s " \
"and your favorite color is %s." % ("name", "nothing", "blue")


#4

Why doesn't this work when I try to replicate it exactly as it is in IDLE and print to Shell?

"raw_input is not defined" it says, am i missing something?

Edit: Also it says "missing parantheses in call to 'print'"
Is the syntax in the code false if you apply it in the real Python program? Like, am i getting wrong information on how to use the code? I don't get it :confused:


#5

What did you put for your raw input?


#6

Well.. I just copy pasted the code from this course to IDLE. I'm not sure what raw_input even means, it was never explained previously :stuck_out_tongue:


#7

Ah okay. Now i understand the problem here.
That code from the course is for Python 2.X and i was trying to copy it ot Python 3.5


#8

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