Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9887715

Have any Question?


Related Questions in Computer Engineering

Question research the options for creating a gui on a sun

Question : Research the options for creating a GUI on a Sun Solaris platform that can be duplicated on a Windows platform. Select a tool for creating a dual platform product and specify how much time would be needed for ...

Assignmenta sudden increase in the demand for smoke

Assignment A sudden increase in the demand for smoke detectors has left Acme Alarms with insufficient capacity to meet demand. The company has seen monthly demand from its retailers for its electronic and battery-operate ...

The probability of a potential employee passing a training

The probability of a potential employee passing a training course is 86%. If you selected 15 potential employees and gave them the training course, what is the probability that more than 12 will pass the test?

Scenario you have been asked to setup a lvm volume for the

Scenario: You have been asked to setup a LVM volume for the Sales group. Your task is to use /dev/sdb to create a logical volume named sales_lvm, format it with XFS, and mount under /sales. Make sure the sales group owns ...

Questiondiscusses the development and evolution of decision

Question: Discusses the development and evolution of Decision Support Systems and identifies several categories : Model Driven DSS Data Driven DSS Communications Driven DSS Document Driven DSS Knowledge Driven DSS Conduc ...

Biodiversity refers to the variety of living organisms

Biodiversity refers to the variety of living organisms found within an ecosystem. In your description, evaluate the role of humans in the current biodiversity loss situation and increased species extinction rate. In addi ...

Can you give me short cut of using excel word access share

Can you give me short cut of using excel, word, access, share point, and powerpoint microsoft, I am always have to rely on the back and forth, fleepng the pages, it is possible

This subject is computer architecture organizationdraw a

This subject is computer Architecture organization Draw a flowchart showing the steps for a CPU program that uses programmed I/O to send a string consisting of 10 characters to a printer connected through a UART interfac ...

Question suppose user process application p1 of one

Question : Suppose user process (application) P1 of one computer wishes to transfer data (file) to process (application) P2 on another computer in the Internet. What addressing information about P2 is necessary for P1 to ...

Question suppose a node is on the same lan as 973939166

Question : Suppose a node is on the same LAN as 97.39.39.166 needs 97.39.39.166's MAC address. What would the destination address of the ARP query be (link layer)? The response must be typed, single spaced, must be in ti ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As