Why let me learn python bald head

I really like a fool

Save this code a bit, I really doubt now

Seek the number of words of input characters

str = input ( "Please enter:")

flag=0

count=0

for c in str:

     if c==" ":

          flag=0

     else:

           if flag==0

              flag==1

              count=count+1

print ( "A total of% d words"% count)

 

I understand Liao, I really was a fool, a start flag = 0 offset by provisions that less space than the word of a defect.

Guess you like

Origin www.cnblogs.com/joyan707/p/11440489.html