Using python version 27 design a program that prompts the


Using Python version 2.7, design a program that prompts the user to enter a string.The program should then display the number of vowels and the number of consonants in the string. I am absolutely lost and don't even know how to start, any assistance would be appreciated.

I will also provide the pseudocode that was provided by the teacher, if it helps at all:

// main module
Module main()
// Variables
Declare String str
Declare Integer index
Declare Integer vowels = 0
Declare Integer consonants = 0
// Get input from the user.
Display "Enter a string."
Input str

// Scan the string counting vowels and consonants.
For index = 0 To length(str) - 1
If isVowel(str(index)) Then
Set vowels = vowels + 1
Else If isConsonant(str(index)) Then
Set consonants = consonants + 1
End If
End For
// Display the results.
Display "Vowels: " , vowels
Display "Consonants: " , consonants
End Module
// The isVowel function returns True if the argument
// is a vowel, or False otherwise.
Function Boolean isVowel(String ch)
Declare Boolean status // Flag
// Convert the argument to uppercase.
ch = toUpper(ch)
// Is ch a vowel?
If ch == "A" OR ch == "E" OR
ch == "I" OR ch == "O" OR
ch == "U" Then
Set status = True
Else
Set status = False
End If
Return status
End Function
// The isConsonant function returns True if the argument
// is a consonant, or False otherwise.
Function Boolean isConsonant(String ch)
Declare Boolean status // Flag
// Is ch a letter?
If isLetter(ch) Then
// Is ch not a vowel?
If NOT isVowel(ch) Then
Set status = True
Else
Set status = False
End If
Else
Set status = False
End If
Return status
End Function

 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Using python version 27 design a program that prompts the
Reference No:- TGS0647083

Expected delivery within 24 Hours