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 %sand your favorite color is %s" %(name, quest, color);what wrong in this code?


#1



Replace this line with your code.


#2

Please post your code again, it's very hard to find out the problem.


#3

Hi, @athiraramachandran ,

Since it has all been pasted into the title, your code is very difficult to understand. Some of the problems that are evident with the code may be an artifact of its being formatted as a title.

When you post code, paste it into the editor window, and be sure to format it. For information on how to do this, see How do I format code in my posts?.

For the title, use a brief phrase that denotes the problem.

Some of the following may not apply, since apparent problems may actually be a result of how the code is presented here.

In the following line, you have a variable, Name, which should be name, in lowercase, so that it matches what you have later in your code ...

Name = raw_input(“What is your name?”)

Also note that the quotes are stylized for a word processor. Use the " character instead. The same applies to all your other lines of code.

In this line. ...

print “Ah, so your name is %s, your quest is %sand your favorite color is %s” %(name, quest, color)

... you omitted a space after the %s formatter that corresponds to the quest variable. That is probably an actual problem, rather than an artifact of the presentation.

As @papusalaatti has suggested, you should post your code again. You may do this after you have attempted to correct the problems.


#4

you don't have space in "%sand"


#6

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, quest, color)

also in Python 3 raw_input has been changed to simply input.

:smiley:


#7

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