Silence 5
Silence 5

Reputation: 11

Error "not all arguments converted during string formatting" what is wrong here?

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

print ("Ah, so your name is {}, your quest is{}, and your favorite color is{}.")str.format(name, quest, color)

Upvotes: 1

Views: 124

Answers (2)

Anil_M
Anil_M

Reputation: 11443

you need to give argument numbers to .format. try below.

print ("Ah, so your name is {0}, your quest is {1}, and your favorite color is {2}.".format(name, quest, color))

Upvotes: 0

Martijn Pieters
Martijn Pieters

Reputation: 1121584

.format() is a method on strings. You need to call it on your template string:

print("Ah, so your name is {}, your quest is{}, and your favorite color is{}.".format(name, quest, color))

Note how the .format() follows directly after the "Ah, so ... is{}." string definition, and the result of that method is passed to the print(...) function for printing.

Upvotes: 1

Related Questions