2022-08-29

Python: 2 Conditions - Read in characters Until x, and Count Vowels

Specification: Read in characters until the user enters a full stop '.'. Show the number of lowercase vowels.

So far, I've succeeded in completing the read loop and printing out 'Vowel Count: '. However, vowel count always comes to 0. I've just started. I'm struggling with placement for 'Show the number of lowercase vowels' Should I define vowels = ... at the top? Or put it in a loop later? Do I create a new loop? I haven't been able to make it work. Thanks

c = str(input('Character: '))
count = 0

while c != '.':
        count += 1
        c = str(input('Character: '))

print("Vowel count =", count)


No comments:

Post a Comment