Use Shift-TAB and TAB in vsCode or in Pycharm to move text left and right for indentation errors
def vowels(sentence):
nvowels = 0
vowels = 'aeiou'
words = sentence.split()
for word in words:
for letter in word:
letter = letter.lower()
if letter in vowels or (letter == word[-1] and letter == 'y'):
nvowels += 1
return nvowels
def test_vowels_in_sentence(sentence):
print(f'{sentence:50} ..... has {vowels(sentence)} vowels')
def test_vowels():
print('\n..................BEGINNING test_vowels()...............')
test_vowels_in_sentence('supEr')
test_vowels_in_sentence('super bOwl')
test_vowels_in_sentence('supEr bOwl in pAsAdena')
test_vowels_in_sentence('A rose by any other name would smell as sweet')
test_vowels_in_sentence('Help me Obiwan you are my only hopE')
test_vowels_in_sentence('I have been here before but always hit the floor')
print('..................ending test_vowels()..................\n')
def main():
test_vowels()
if __name__ == '__main__':
main()
#=========================================================
# OUTPUT
#=========================================================
# ..................BEGINNING test_vowels()...............
# supEr ..... has 2 vowels
# super bOwl ..... has 3 vowels
# supEr bOwl in pAsAdena ..... has 8 vowels
# A rose by any other name would smell as sweet ..... has 16 vowels
# Help me Obiwan you are my only hopE ..... has 14 vowels
# I have been here before but always hit the floor ..... has 17 vowels
# ..................ending test_vowels()..................
Bryce H.
It is still giving me the error that way as well.01/23/23