Question

Using python beginners code Assign it to a variable Use Python’s len() method to determine the...

Using python beginners code

Assign it to a variable

Use Python’s len() method to determine the word’s length

Print the length using labeled output

Example: Word length = 18 letters

Repeat the exercise using a for loop to determine the word’s length

Use the count() method to determine the number of times each vowel occurs in the word

Count each vowel separately

Print your results

Repeat the exercise using a for loop and if-elif-else

Count each vowel separately

Print your results

0 0
Add a comment Improve this question Transcribed image text
Answer #1
s = input("Enter string: ")
lst = [0,0,0,0,0]

for x in s:
    if(x.lower() == 'a'):
        lst[0] += 1
    elif(x.lower() == 'e'):
        lst[1] += 1
    elif(x.lower() == 'i'):
        lst[2] += 1
    elif(x.lower() == 'o'):
        lst[3] += 1
    elif(x.lower() == 'u'):
        lst[4] += 1
print("Count of letter 'a' is",lst[0])
print("Count of letter 'e' is",lst[1])
print("Count of letter 'i' is",lst[2])
print("Count of letter 'o' is",lst[3])
print("Count of letter 'u' is",lst[4])

Add a comment
Know the answer?
Add Answer to:
Using python beginners code Assign it to a variable Use Python’s len() method to determine the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create simple python beginners code that outputs a proverb upon request. Find 7 proverbs, wise sayings,...

    Create simple python beginners code that outputs a proverb upon request. Find 7 proverbs, wise sayings, or quotes Store your proverbs in an if-elif-else decision structure (see below) Your application should locate the corresponding proverb Print the proverb and its explanation to the screen, each on a separate line. Write a “welcome” message that greets the user and explains how the program works Ask your user to enter a positive integer. Echo back the user’s choice – for example, “You...

  • Python Problem Hello i am trying to finish this code it does not save guesses or...

    Python Problem Hello i am trying to finish this code it does not save guesses or count wrong guesses. When printing hman it needs to only show _ and letters together. For example if the word is amazing and guess=a it must print a_a_ _ _ _ not a_ _ _ _ and _a_ _ _ separately or with spaces. The guess has a maximum of 8 wrong guesses so for every wrong guess the game must count it if...

  • IN PYTHON. We have seen examples of using the python re library. In this practice, you...

    IN PYTHON. We have seen examples of using the python re library. In this practice, you need to write python code and complete following tasks. (You can decide whether you want to define functions and how to organize your code. It is for your own practice.) 1). Define 10 string variables that follows the requirement given an integer, a float, a double, a float end with letter f (4.321f), Capital Letters( followed by small case letters, followed by digits, Exactly...

  • Can you please enter this python program code into an IPO Chart? import random def menu():...

    Can you please enter this python program code into an IPO Chart? import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the non-numbers #if user enters letters, then except will show the message, Numbers only! try: c=int(input("Enter your choice: ")) if(c>=1 and c<=3): return c else: print("Enter number between 1 and 3 inclusive.") except: #print exception print("Numbers Only!")...

  • HEy GUYS PLZ I WROTE THIS CODE BUT I WAS ASKED TO ADD SOME ASSERTION TESTS AND I HAVE NEVER DONE SUCH THING. CAN YOU GUY...

    HEy GUYS PLZ I WROTE THIS CODE BUT I WAS ASKED TO ADD SOME ASSERTION TESTS AND I HAVE NEVER DONE SUCH THING. CAN YOU GUYS HELPS ME OUT ON HOW TO TEST A SIMPLE CODE SINCE ITS A GUESSING GAME! THANK YOU. PYTHON import random # here it allows us to use the benefits of the functions random #function 1 which is just a screen organized wordings def screen): screeninstructions () name input("Your Name : ") print('Welcome, name, 'This...

  • Here is my code to put a quote down, flip it, and reverse it. I do...

    Here is my code to put a quote down, flip it, and reverse it. I do not have much knowledge on coding. Does my code only use Variables, Console I/O, Java Program Design, Intro to IDEs, If Statements, Selection and Conditional Logic, Strings, Loops, Nesting, and Iteration? If not, could it be fixed to only use them? These are the offical steps of the assignment: - Ask a user to enter a quote - whether it's several sentences or a...

  • Part 1: Using Idle Write a Python Script that Does the Following 1. At the top...

    Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment...

    PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment the lines please so I can understand. There are short and med files lengths for each the list of names/ids and then search id file. These are the input files: https://codeshare.io/aVQd46 https://codeshare.io/5M3XnR https://codeshare.io/2W684E https://codeshare.io/5RJwZ4 LinkedList ADT to store student records(code is below). Using LinkedList ADT instead of the Python List. You will need to use the Student ADT(code is below) Imports the Student class...

  • Write two functions: Main should call the first function. The first function should use getline to...

    Write two functions: Main should call the first function. The first function should use getline to read a line of data: getline(cin,variableToHoldLineOfData); It should then call the second function, sending the line of data it just read. The second function should determine the number of CAPITAL letters, the number of lowercase letters, and the number of everything else (that's not capital or lower case). Count the length of the string and then use a for loop to go through each...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT