On Thu, Feb 5, 2015 at 3:57 PM, Edgar Figueroa <[email protected]> wrote:
> Hello group. I'm trying to call the variable "name" within my input ()
> function.
> Here's what I have:
> name = input("Hello. What's your name? ")
> print("\nHello", name, ". Nice to meet you.")
> favFood1 = input("\n", name, ", what's your favorite food? ")
> Obviously it isn't working. It tells me I have too many arguments for the
> input ()
Try not to paraphrase error messages. Rather, copy-and-paste the
error message exactly as the computer says. This might seem counter
to what you're used to doing, but it helps because sometimes the
slightest detail helps to figure out what's going on.
In particular, your program has *two* uses of input. But the error
message should have said which one was problematic, and I'm pretty
sure it has done so! But since you've paraphrased the message, we
would not be able to tell which one was broken, even if the error
message said exactly which one was wrong. *That's* why you should
avoid paraphrasing error messages.
In any case, since there's only two, we can look and see that the
problematic one is probably this:
favFood1 = input("\n", name, ", what's your favorite food? ")
You want to pass input() a single string. But you have a few strings there.
Do you know about "string appending" or "string concatenation"?
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor