Write code that will calculate number of vowels in a string

Assignment Help Python Programming
Reference no: EM132390082

(a) Total number of vowel occurrences in a string

To answer this question, you need to write code that will calculate the number of vowels in a string. You should count each occurrence of any vowel and count vowels both in upper and lower case, so a vowel is any of the letters in the string: aeiouAEIOU. (Do not count "y", though it may be used as a vowel, e.g. in "my".)

Examples

INPUT

OUPUT

yyyyk z

0

A cat sat on a mat

6

Abracadabra

5

Eutopia

5

(b) Number of different vowels in a string

To answer this question you need to write code that will determine the number of different vowels in a string input by the user. By "different vowels" we mean that if the same vowel occurs more than once it is only counted once. Moreover, small and captial versions of the same letter do NOT count as different vowels. Thus, the number given as the answer will always be from 0 to S (inclusive).

Examples

INPUT

OUPUT

yyyyk z

0

A cat sat on a mat

2

Abracadabra

1

Eutopia

5

(c) Anonymise a string

For certain purposes, e.g. reviewing academic articles, it may be required that names in documents be anonymised to hide the identiy of the person referred to. It may also be required to preserve formatting, so that the space taken up by the anonymised name is approximately the same as the original name.

A simple way to do this is to replace all the letters with Xs. Your program should carry out this operation. More specifically you should transform the input string by replacing each capital letter by 'X' and each lower case letter by 'x'.

Examples

INPUT

OUPUT

Brandon Bennett

Xxxxxxx Xxxxxxx

Hello!

Xxxxx!

Alfred E.      Neuman

Xxxxxx X. Xxxxxx

Password Strength
An institution uses the following rules to classify the strength of passwords:
• A string is a WEAK password if it is less than 8 characters long.
• A string is a STRONG password if:
o it contains at least 11 characters
o AND it contains at least 1 lower case letter
o AND it contains at least 1 capital letter
o AND it contains at least 1 numerical digit.
• A string is a MEDIUM password if it is NOT a WEAK password AND is NOT a STRONG password.

You need to write code that will take input of a string from the keybord and will print the strength of that string as a password, according to the rules given above. So it should output one of the strings STRONG, WEAK or MEDIUM

Examples:

Examples

INPUT

OUPUT

hello

WEAK

7Ki ngs8a1 1 9R i es

STRONG

brandon123

MEDIUM

Megabyte Energy Bars Question

The SnackShack convenience store sells Megabyte energy bars according to the following pricing rules:

• Single Megabyte bar: £1.25

• Megabyte Sixpack (6 bars): £5

• 10% Discount given on all orders of £20 or more!

To answer this question, write a Python program that takes one input, which is the number of Megabyte bars a customer wants to buy, and gives 1 output which is the total cost in pounds of buying that number of Megabyte bars.

Examples

Num Bars        (input)

Cost in £s (output)

Cost Breakdown

3

3.75

3 single bars

12

10

2 six packs

15

13.75

2 sixpacks and 3 single bars

26

20.25

4 sixpacks,     2 singles     (22.50),      10% discount       (-2.25).

Reference no: EM132390082

Questions Cloud

What clinical problem or issue the organization is facing : During your practicum, determine what clinical problem or issue the organization is facing. Discuss two implications for nursing. (First problem) Nursing short
What is the main issue for your organization : What is the main issue for your organization in addressing a solution to evidence-based nursing practice? Discuss what might be the first step in addressing.
Describe the significance and relevance of the problem : Describe the significance and relevance of the problem. What is the appropriate communication level for the target audience's educational experience in order.
Explain the five stages of group development : Based on what you have learned so far this week, create a PowerPoint presentation (minimum 12 slides) with detailed notes for each slide that addresses.
Write code that will calculate number of vowels in a string : Write code that will calculate the number of vowels in a string. You should count each occurrence of any vowel and count vowels both in upper and lower case.
Create and implement a policy that addresses social prolem : As an astute social worker and professional policy advocate, once you have selected and identified a social problem, you begin the process of creating.
Identifies transformational and charismatic leader behaviors : Identifies transformational and charismatic leader behaviors. In your opinion, which of the behavioral components does Ms. Burns exemplify
Develop a Graphical User Interface : You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the CityLodge rental room management program
Senior management for future strategic planning : Explain an approach that you would present to senior management for future strategic planning.

Reviews

Write a Review

Python Programming Questions & Answers

  Ask the user for a length and a width of a rectangle

Asks the user for a length and a width of a rectangle. Each or all input will happen in a function and will then be returned from a function.

  Create a python program that accepts two integer numbers

Create a Python program that accepts two integer numbers as input from the user. The program should then add the two numbers and print the sum as output.

  Write an expression whose value is the concatenation

Write an expression whose value is the concatenation of the three str values associated with name1, name2, and name3, separated by commas.

  Write a while loop that prints all squares less than n

Introduction to Programming Concepts Python. Write a while loop that prints All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81.

  Write a program in python to draw a simplified face

Write a program in Python to draw a blue triangle in a drawing window. Write a program in Python that moves the triangle in an animated movement. Write a program in Python to draw a simplified face.

  Define a function write scores with two parameters

Define a function write Scores with two parameters . The first should be the name of a file , and the second should be a list of integer scores.

  You are tasked with improving the code for the haunted

you are tasked with improving the code for the haunted house game. please read the associated hand-out and the code

  What is the difference in execution speed

In Python, Using a random number generator, create a list of 500 integers.

  Describe the original data for the city you are observing

Describe the original data for the city you are observing. Regression Analysis Hypothesis testing. Explain the hypothesis and the result by graph.

  Write a program that opens an encrypted file

Write a second program that opens an encrypted file and display its decrypted contents on the screen.

  Conduct research on the fibonacci sequence

Conduct research on the Fibonacci sequence. Write a 150 word summary of the information. Include examples and real world application for it.

  Create a cheat commands in the game

ISCG5420 Programming Fundamentals - Create a cheat commands in the game so player can pick up any item he wants from any location in the map.

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