x = input("desired text to be analyzed ")
numspace = 0
i = 0
while i < len(x):
if x[i] == " ":
x = x[:i] +x[i+1:]
numspace += 1
else:
i+=1
print(numspace,x)
x = input("desired text to be analyzed ")
numspace = 0
i = 0
while i < len(x):
if x[i] == " ":
x = x[:i] +x[i+1:]
numspace += 1
else:
i+=1
print(numspace,x)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.