User:Laura Macchini/prototyping/marryme

From XPUB & Lens-Based wiki

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 "+items[x]+" to put on?"
	print
	if x != 2:
		print "Off to the "+places[x]+" she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put "+midlist[1]+" on"
	else:
		print "Off to the "+places[x]+" she did go \n As fast as she could run \n She brought him back the finest that was there \n Now soldier, put "+midlist[0]+" on"
	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 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?