Skip to content

Instantly share code, notes, and snippets.

@emadehsan
Created May 30, 2018 16:39
Show Gist options
  • Save emadehsan/a0059c657a97a7ac700aaa6fc6f3b52c to your computer and use it in GitHub Desktop.
Save emadehsan/a0059c657a97a7ac700aaa6fc6f3b52c to your computer and use it in GitHub Desktop.
# this is a comment
s = 'Quick brown fox jumps over lazy white dog'
scount = 0
for c in s :
if c == 'a' or c == 'o' or c == 'u' or c == 'i' or c == 'e':
# "count" in the following line is being used for the first time. It is one level deep i.e. inside the loop. So its value will not be available outside the loop.
# count += 1
# so use scount to access the value outside the loop as well. because scount was already declared outside the loop
scount += 1
print("Number of vowells: " + str(scount))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment