RWET First week work

import randomi = 1
f = open('Tao Te Ching.txt')

alllines = []

wordsperline = [] 

for line in f.readlines():
	alllines.append(line.strip())

evenlines = []
linenumber = 0

for line in alllines:

	if linenumber % 2 == 0:
		evenlines.append(line)
	linenumber += 1

oddwords = []
wordnumber = 0
oddwordnumber = 0
for line in evenlines:
	words = line.split()
	#wordsperline.append(len(words))
	#print len(words)
	for word in words:
		#print word
		if wordnumber % 2 != 0:
			oddwords.append(word)
			oddwordnumber += 1
		wordnumber += 1
	wordsperline.append(oddwordnumber)
	#print wordnumber
	wordnumber = 0
	oddwordnumber = 0
	linenumber += 1

# for number in wordsperline:
# 	print number

import string
#letters = ['a', 'b', 'c', 'd','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
string.letters = 'abcdefghijklmnopqrstuvwxyz'
whichline = 0
whichword = 0
returnedwords = []
for word in oddwords:
	#randomnumber = random.randint(0, len(letters))
	#randomletter = letters[randomnumber]
	randomletter = random.choice(string.letters)
	word += str(randomletter)
	word += " "
	whichword += 1
	whichwordold = whichword - 1
	if whichwordold == wordsperline[whichline]:
		#print wordsperline[whichline]
		#word += "\n"
		whichline += 1
		whichword = 0
	returnedwords.append(word)

joinedwords = "".join(returnedwords)

print joinedwords

#for word in returnedwords:
#	print word

 

Taok cany spokenn nota eternalx namelesse thex ofi andg constantlyr desire,q observesq essencez twol togetherc differd namec ofp thec tox wondersn thea knowso asc uglinessd beings non-beings eachh andb revealr otherj andl harmonizen otherc thew they ofp wordsg createe doe possessj succeedk doz dwellr successw itn goesf thef willc squabbleo they willk becomeh theiru willv bea thej ofm sage:j theirv theird thev havej cunningy nox nothingo bet controlk Taov emptyq deep!c seemsa bet sourcel alls bluntsp sharpnessv thex doz knowo offspringd ish regardq thingsl strawa regardc asv dogso spaceq Heaveng Earthh andc neverc comparee keepingg thee 

 

I use the first five chapters of Tao Te Ching as the raw material. I pick up the odd words in even line and add an extra letter behind each of them.