s = raw_input("Enter a string: ")
a = 0
i = 0
for i in range(len(s)):
if s[i] == ' ':
a = a + 1
print str(a) + '. ' + 'There was a space in position ' + str(i) + '.'
i keep on trying to sub in while instead but it won't compute an answer.