mardi 1 juin 2021

How do I put to add number of lines in my vowels code? [closed]

I tried this, but I am not able to insert the lines of code

strg = input("Please Enter Your Own String : ")
vowels = 0
consonants = 0

for i in strg:
    if (i == 'aeiouAEIOU'):
        vowels = vowels + 1
    else:
        consonants = consonants + 1

print("Number of Vowels: ", vowels)
print("Number of Consonants: ", consonants)

Python program that asks the user for the number of lines for the entered poem. It then allows the user to enter the desired number of lines. Then output the number of lines, vowels and consonants in the poem and in each line. For simplicity, let us enter the poem in small English letters only. Input example: How many lines will there be? 4

Once there was an elephant, Who tried to use the telephant No! No! I mean an elephone Who tried to use the telephone

Example result:

Number of vowels: 40

Number of consonants: 51

       

Aucun commentaire:

Enregistrer un commentaire