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 Enter a noun: happiness Enter a noun: danger Enter an animal: elephant Enter a food: burger Enter a fruit: watermelon Enter a number: 1985 Enter a superhero_name: batman Enter a country: america Enter a dessert: icekachang Enter a year: 1984 This morning I woke up and felt because _ was going to finally h e big _ honest. On the other sid onesty were many patiences prote eep elephant in stores. The crow _ to the rythym of the burger, all of the runs very _. happine o _ into the sewers and found wa ats. Needing help, pretty quickl ump. 1985 appeared and saved cai by flying to batman and dropping puddle of america. icekachang th leep and woke up in the year 198 rld where dangers ruled the worl $
On Thursday, April 28, 2016 at 3:25:46 PM UTC+8, Steven D'Aprano wrote: > On Thursday 28 April 2016 17:08, Stephen Hansen wrote: > > > On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote: > >> Stephen Hansen <m...@ixokai.io> 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. [...] > >> > > > >> > > <URL:https://docs.python.org/3/library/string.html#formatstrings> > >> > > >> > Except the poster is not using Python 3, so all of this is for naught. > >> > >> Everything I described above works fine in Python 2. Any still-supported > >> version has 'str.format'. > > > > This response is completely unhelpful. The OP is using Python 2, and > > using %-formatting, and so you give a series of examples of using > > str.format, to, what? Confuse matters? > > How about we assume good faith and give Ben the benefit of the doubt that he > simply made a minor and trivial misjudgement rather than accusing him of > intentionally trying to confuse matters? > > You are correct that the OP can use % formatting with named arguments. Ben > is correct that the OP can also change his code to use str.format. Some > people hate %-formatting and cannot wait to migrate to {}-formatting, and > some people don't. > > (For the record, Internet rumours that %-formatting is deprecated are simply > not correct.) > > > > -- > Steve -- https://mail.python.org/mailman/listinfo/python-list