Design a program that prompts the user to enter a string

Assignment Help Basic Computer Science
Reference no: EM13308397

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

 

Reference no: EM13308397

Questions Cloud

Which water is sprayed directly into exhaust duct upstream : The engineer in charge of this project investigated severla alternatives to cool the exhaust gas and has concluded that the two most practical solutions would be either the installation of a waste heat boiler or the installation of a spray injecti..
Outline and explain the concept of internal marketing : Outline and explain the concept of internal marketing and why it is important in service products. How would you introduce an effective internal marketing programme to an organisation?
Calculate the velocity of a wave on this bungee cord : A bungee cord is stretched between two poles with a force of 357 N. What is the velocity of a wave on this bungee cord
Determine the buoyant force acting on the object : An object falls off of a pier and into the ocean (sea water) where it displaces a total volume of 1.6 cubic meters of sea water. What is the buoyant force acting on the object
Design a program that prompts the user to enter a string : 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 assistan..
Find what would be the minimum number of truckloads : Soil is excavated from a borrow to construct an embankment with a net volume of 50,000 cy with 95% of Modified Proctor maximum dry density of 110 pcf with a Modified Proctor optimum water content of 8%.
Compute and return to main totalrainfall and averagerainfall : It should also have two value-returning functions that compute and return to main the totalRainfall and averageRainfall.
Determine modulus of elasticity of concrete by aci formula : Determine the Modulus of Elasticity of Concrete by the ACI formula for a concrete cylinder that has a unit weight of 120pcf (1920kg/m^3) and a compressive strength of 3000 psi (21MPa).
Make a spreadsheet to compare e-commerce sites : create a spreadsheet to compare the three identified e-commerce hosting sites and the e-commerce hosting site that you find • prepare a PowerPoint presentation that represents the presentation you would give to management explaining your selection..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Staffing level requirements for project team

Describe in scholarly detail how you would use WBS as aid to finding staffing level requirements for project team?

  Laws and regulation in telecommunications field

Do you believe we require laws and regulation in telecommunications field at all? Why or why not?

  Write a program that asks the user to enter a string

Write a program that asks the user to enter a string. Create a pointer called strPtr and print the first character, third character and fifth character from your string using this pointer.

  Remember to make only one step at a time

Prove the following. Remember to make only one step at a time and not skip steps. Remember to write what rule allowed you to make each step, and which lines you applied it to

  Use two arrays of integers to store two test scores

You must use 2 arrays of integers to store the 2 test scores for each student. You must use a third array to store the average and a fourth array to store the letter grade.

  Prepare disaster recovery plan for organization

Prepare a Disaster Recovery (DR) Plan for following organization; Company; Widget Works Electronics, Employees; 250, Infrastructure; 1 Central Office building housing primary datacenter. 10 satellite sales branches.

  Create flowchart and psuedo code for math program

Create flowchart and psuedo code for math program which permits the user to enter two separate numbers and choose one of four mathematical operations (add, subtract, mutiply, divide).

  Discuss its usage in programming

What is a ? Discuss its usage in programming

  Describing data-s confidentiality and integrity

They are asking candidates to describe briefly how they would satisfy StoreItRite's requirements as stated above. How would a successful candidate respond?

  Processor do when it receives an interrupt request

What does the processor do when it receives an interrupt request from an external device? Describe the sequence of events and the signals activated.

  Explaining statement for security policy

Write a statement for security policy for the following:Let LAN for small 100-person business, Pixel Inc. Business occupies one floor in office building. Everybody has a computer on his or her desk.

  Compute average probability of symbol error of signalling

Consists of additive noise w(t) as the sample function of a gaussian process with zero mean and power spectral density No/2. Calculate the average probability of symbol error for this method of signalling

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd