3 words. It stops with TypeError instead.
class Sentence:
def __init__(self, text):
self.words = text.split()
def count():
return len(self.words)
s = Sentence("to be free")
print(s.count(), "words")
Which one change makes the program print 3 words?Log in to join the discussion.
Loading…