Skip to content

Instantly share code, notes, and snippets.

@marcusRB
Created July 2, 2017 13:07
Show Gist options
  • Save marcusRB/47c58b2717d457e587193e2ac07c8504 to your computer and use it in GitHub Desktop.
Save marcusRB/47c58b2717d457e587193e2ac07c8504 to your computer and use it in GitHub Desktop.
Ex6 - For Loops
school = 'Massachusetts Institute of Technology'
numVowels = 0
numCons = 0
for char in school:
if char == 'a' or char == 'e' or char == 'i' \
or char == 'o' or char == 'u':
numVowels += 1
elif char == 'o' or char == 'M':
print(char)
else:
numCons -= 1
print('numVowels is: ' + str(numVowels))
print('numCons is: ' + str(numCons))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment