nick34992
1/12/2017 - 4:09 AM

MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise 6c

MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise 6c

#!/usr/bin/python3

sentence = 'Jaded zombies acted quaintly but kept driving their oxen forward.'
numVowels = 0
numCons = 0

for char in sentence:
    if char == 'a' or char == 'e' or char == 'i' or char == 'o' or char == 'u':
        numVowels += 1
    else:
        numCons += 1

print('numVowels is: ' + str(numVowels))
print('numCons is: ' + str(numCons))

'''
MITx 600.1x | Week 1 | Python Basics | 2. Core Elements of Programs | Exercise 6c

numVowels is: 20
numCons is: 45
'''