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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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