All pastes #66415 Raw Edit

Unnamed

public text v1 · immutable
#66415 ·published 2006-06-17 00:02 UTC
rendered paste body
def again():
	seq = raw_input("\nGive me something to argue:\t")
	input(seq)

def convertSentenceToWord(sentence):
	word = ""
	words = []
	for char in sentence:
		char = char.lower()
		if char.isspace():
			words.append(word)
			word = ""
		else:
			word += char
	words.append(word)
	return words
	
def input(tsentence):

	final_wordlist = ""
	final_list = []
	wordList = {"you":"I","are":"am not","one":"a"}
	words = convertSentenceToWord(tsentence)
	for word in words:
		if word in wordList:
			final_list.append(wordList[word])
		else:
			final_list.append(word)
	#print final_list[0], final_list[1]
	if final_list[0] == "I" and final_list[1] == "am not":
		final_list.append(", you")
		final_list.append("are")
	for f in final_list:
		final_wordlist = str(final_wordlist) + f +" "
	final_wordlist = "Computer responds: \t\t" + final_wordlist + "\n"
	print final_wordlist
	again()

seq = raw_input("\n\nGive me something to argue:\t")
input(seq)