User:Laura Macchini/prototyping/marryme: Difference between revisions
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
for x in range(0,3): | for x in range(0,3): | ||
print beginning | print beginning | ||
print "When I have no " | print "When I have no {0} to put on?".format(items[x]) | ||
print | print | ||
if x != 2: | if x != 2: | ||
print "Off to the | print "Off to the {0} she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put {1} on".format(places[x],midlist[1]) | ||
else: | else: | ||
print "Off to the | print "Off to the {0} she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put {1} on".format(places[x],midlist[0]) | ||
print | print | ||
print beginning | print beginning | ||
Line 80: | Line 80: | ||
She brought him back the finest that was there | She brought him back the finest that was there | ||
Now soldier, put it on | Now soldier, put it on | ||
Soldier, soldier, will you marry me | Soldier, soldier, will you marry me |
Latest revision as of 12:35, 21 October 2011
The Code
#!/usr/bin/python
beginning = " Soldier, soldier, will you marry me \n With your musket, fife and drum? \n Oh how can I marry such a pretty little girl"
items = ["coat","shoes","hat"]
ending = "When I've a wife and child at home?"
midlist = ["it","them"]
places = ["tailor","cobbler","hatter"]
for x in range(0,3):
print beginning
print "When I have no {0} to put on?".format(items[x])
print
if x != 2:
print "Off to the {0} she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put {1} on".format(places[x],midlist[1])
else:
print "Off to the {0} she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put {1} on".format(places[x],midlist[0])
print
print beginning
print ending
The Result
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no coat to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now soldier, put them on
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no shoes to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now soldier, put them on
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no hat to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now sol Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no coat to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now soldier, put them on
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no shoes to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now soldier, put them on
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I have no hat to put on?
Off to the tailor she did go
As fast as she could run
She brought him back the finest that was there
Now soldier, put it on
Soldier, soldier, will you marry me
With your musket, fife and drum?
Oh how can I marry such a pretty little girl
When I've a wife and child at home?