This program should count the words that are made of letters only. For this text the answer is 3, but it prints 5.
words = "cat dog42 bird fish".split(" ")
count = 0
for w in words:
if w.isalpha:
count += 1
print(count)
Which changes, each made on its own, make it print 3? Choose every correct option.
One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.
Log in to join the discussion.
Loading…