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
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
>> > > (not positional)
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 give a
> series
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. […]
> > >
> > > https://d
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. […]
> >
> > https://docs.python.org/3/library/string.html#formatstrings>
>
> Except the
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 missing or extra, because I'
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 :)
Better: when you have ma
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
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 ad
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 cas
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
--
https://mail.python.org/mailman/listinfo/pyt
11 matches
Mail list logo