record = 0 scorearray=[] citycount=0 for line in f: #print line size = len(line) question = [] sentence= [] question.append('') qstring = '' numwords=0 word = '' replaced=0 for i in range(size): if line[i] not in string.whitespace: word = askfunc.fappend(word,line[i]) if word=='city': citycount+=1 else: if word.lower() == 'he' and replaced!=1: if word == 'he': sentence.append('who') else: sentence.append('Who') replaced=1 else: if word != 'also': sentence.append(word) if word == 'was' and numwords<2: question[0] = 'Was'
def test_fappend_lists(self): testlist1 = ["a", "b", "c"] testlist2 = ["d", "e"] testlist1 = testlist1 + testlist2 self.assertEquals(testlist1, askfunc.fappend(testlist1, testlist2))
def test_fappend_mixed(self): testword1 = "test" testlist1 = ["a", "b", "c"] testword = testword1 + testlist1 self.assertEquals(testword, askfunc.fappend(testword1, testlist1))
def test_fappend_words(self): testword1 = "test" testword2 = "this" testword1 = testword1 + testword2 self.assertEquals(testword1, askfunc.fappend("test", "this"))