Created
May 30, 2018 16:39
-
-
Save emadehsan/a0059c657a97a7ac700aaa6fc6f3b52c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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