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

  Thread problem

Implement what is kind of the inverse of our Producer - Consumer, where many Producers supply a limited capacity consumer.

  Shortest path between each pair of nodes using floyd''s metho

find the shortest path between each pair of nodes using Floyd's method

  Evaluating average degree of a vertex for geometric graph

For random geometric graph, G(n, r), evaluate average degree of a vertex: at least distance r from boundary, on boundary (convex hull), and estimate time (big Oh) of determining all edges employing: all vertex pairs testing.

  Use map to define convert-euro converts list of us dollars

Use map to define the following functions: convert-euro, which converts a list of U.S. dollar amounts into a list of euro amounts based on an exchange rate of 1.22 euro for each dollar.

  Define a class named circle

Define a pure abstract base class called BasicShape. The BasicShape class should have the following members.

  Create a table consisting of each integer and its square

Write the MATLAB statements required to calculate and print out the squares of al the even integers between 0 and 50. Create a table consisting of each integer and its square, with appropriate labels over each column. I MUST use a while loop but I..

  Write a main program which will prompt the user

Write a Main Program which will prompt the user for how many numbers they which to enter as an integer counter (numcount) variable. The program should then prompt the user to enter each number using a loop and then output the average of the number..

  Describe of what the computer considers true or false

For your initial post, provide your own description of what the computer considers "TRUE" and what the computer considers "FALSE." Then, provide at least two code examples (original examples) that would return TRUE

  Largest problem can be solved if total execution time given

In general, is it possible to solve arbitrarily large problem in a fixed amount of time, given that unlimited number of processing elements is available? Explain why?

  Write program mips assembly adds two integer and display sum

Write a MIPS assembly language program that adds two integers and displays the sum and the difference.

  Sentinel-controlled repetition to allow a user

The computeShippingCharges() method should use sentinel-controlled repetition to allow a user to enter shipping data until the user has indicated that he or she is done. The total shipping charges will be computed and returned as a double value.

  Suggest a way to find web servers for the department

Can you suggest a way to roughly find out the web servers (outside your department) which are not popular among the users in the department? Describe.

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