Strings & Console Output


#1



https://www.codecademy.com/en/courses/python-beginner-sRXwR/3/4?curriculum_id=4f89dab3d788890003000096#


i get a bad mesage at the end

Traceback (most recent call last):
File "python", line 6, in
TypeError: 'str' object is not callable


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 %, your quest is %, " \
"and your favorite color is %."  (name, quest, color)


#2

Try putting a percent sign between your print string and (name, quest, color)


#3

i did that and it said Oops, try again. Make sure to use a lowercase "s" with \%s. Python told us about the following error: unsupported format character ',' (0x2c) at index 21


#4

Okay, right. You need to have %s in the actual string and then a plain percent sign between the string and the (name, quest, color).

Your print statement should be as follows:

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


#5

print "Ah, so your name is %, your quest is %, " \
"and your favorite color is %." % (name, quest, color) like this


#6

do i need the s in the % also


#7

Nope, it should be exactly like I posted. %s in the side of the quotes and just a plain % before (name, quest, color)

It should be exactly as follows:

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


#8

Thanks dude nice to have this amount of help


#9

@jamescoderchamp The placeholder sign is suppose to be like this:

%s
``` 
instead of what you did:

```
%

Replace the signs as needed for the code to be correct. :slight_smile:


#10

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