Skip to content

Instantly share code, notes, and snippets.

@sourcefrog
Created January 23, 2017 22:06
Show Gist options
  • Save sourcefrog/5e5eb794e47e6a4c5743dbdf16b27bc3 to your computer and use it in GitHub Desktop.
Save sourcefrog/5e5eb794e47e6a4c5743dbdf16b27bc3 to your computer and use it in GitHub Desktop.
def cw(w):
r = 0
iw = False
for c in w:
if c == ' ':
if iw:
r += 1
iw = False
else:
iw = True
return r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment