Re: Python Madlibs.py code and error message

2016-05-03 Thread Cai Gengyang
Ok, I got it to work with no error message finally ... Enter a name: cai gengyang Enter an adjective: beautiful Enter a second adjective: honest Enter a third adjective: pretty Enter a verb: hit Enter a second verb: run Enter a third verb: jump Enter a noun: honesty Enter a noun: patience

Re: Python Madlibs.py code and error message

2016-04-28 Thread Steven D'Aprano
On Thursday 28 April 2016 17:08, Stephen Hansen wrote: > On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote: >> Stephen Hansen writes: >> >> > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: >> > > Better: when you have many semantically-different values, use named >> > >

Re: Python Madlibs.py code and error message

2016-04-28 Thread Ben Finney
Stephen Hansen writes: > On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote: > > Everything I described above works fine in Python 2. > > This response is completely unhelpful. I'll let the OP be the judge of that. > The OP is using Python 2, and using %-formatting, and so you

Re: Python Madlibs.py code and error message

2016-04-28 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote: > Stephen Hansen writes: > > > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > > > Better: when you have many semantically-different values, use named > > > (not positional) parameters in the format string. […] > > > >

Re: Python Madlibs.py code and error message

2016-04-28 Thread Ben Finney
Stephen Hansen writes: > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > > Better: when you have many semantically-different values, use named > > (not positional) parameters in the format string. […] > > > >

Re: Python Madlibs.py code and error message

2016-04-28 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > Stephen Hansen writes: > > > The error message means there's a mismatch between the number of > > formatting instructions (ie, %s) and arguments passed to formatting. I > > leave it to you to count and find what's

Re: Python Madlibs.py code and error message

2016-04-27 Thread Ben Finney
Stephen Hansen writes: > The error message means there's a mismatch between the number of > formatting instructions (ie, %s) and arguments passed to formatting. I > leave it to you to count and find what's missing or extra, because I'm > seriously not going to do that :)

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:01 PM, Cai Gengyang wrote: > I changed it to all lowercase, this time I get a different error message > though (a TypeError message) The error message means there's a mismatch between the number of formatting instructions (ie, %s) and arguments passed to formatting. I

Re: Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
I changed it to all lowercase, this time I get a different error message though (a TypeError message) # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective1 = raw_input("Enter an

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 09:37 PM, Cai Gengyang wrote: > print STORY % (Adjective1, name, Verb1, Adjective2, Noun1, Noun2, animal, > food, Verb2, Noun3, fruit, Adjective3, name, Verb3, number, name , > superhero_name, superhero_name, name, country, name, dessert, name, year, > Noun4) Python is

Re: Python Madlibs.py code and error message

2016-04-27 Thread Gregory Ewing
Cai Gengyang wrote: adjective1 = raw_input("Enter an adjective: ") NameError: name 'Adjective1' is not defined Python is case-sensitive. You've spelled it "adjective1" in one place and "Adjective1" in another. You need to be consistent. -- Greg --

Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
Python Madlibs.py code and error message --- Anyone can help? I keep getting stuck here ... # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective1 = raw_input