Created
July 2, 2017 13:07
-
-
Save marcusRB/47c58b2717d457e587193e2ac07c8504 to your computer and use it in GitHub Desktop.
Ex6 - For Loops
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
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