planetclass - count = count +1 return count def...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Sentence: c def __init__(self, sentence): sentence = sentence.split() self.sent = sentence def getSentence(self): string = "" for ch in self.sent: string = string + ch + " " return string def getWords(self): print(self.sent) def getLength(self): string = "" for ch in self.sent: string = string + ch + " " print(len(string)) def NumWords(self): count = 0 for i in range(len(self.sent)):
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: count = count +1 return count def makeCaps(self): string = "" for ch in self.sent: string = string + ch + " " upstring = string.upper() return upstring def addPunc(self): string = "" for ch in self.sent: string = string + ch punc = string[0:] + '.' return punc myobject = Sentence("this is my string") m...
View Full Document

This document was uploaded on 12/14/2010.

Ask a homework question - tutors are online