Hello.
I have a program that counts numbers and words in a sentence. I have such a problem with this program: it gives results for one line (the first line we enter and we exit the program) or for the last one when we enter more lines.
Will anyone help me to rewrite this program to display the number of numbers and words for each entered line after finishing typing?
I have a program that counts numbers and words in a sentence. I have such a problem with this program: it gives results for one line (the first line we enter and we exit the program) or for the last one when we enter more lines.
while 1:
try: znaki= raw_input().split()
except EOFError: break
liczby = 0
slowa = 0
for i in range(len(znaki)):
if znaki[i].isdigit() == 1: liczby += 1
else:
slowa += 1
print liczby, slowa
Will anyone help me to rewrite this program to display the number of numbers and words for each entered line after finishing typing?