Question

Write a Python program to check whether a character entered as input is a vowel or...

Write a Python program to check whether a character entered as input is a vowel or consonant. A vowel is any letter that is “a”, “e”, “i”, “o”, or “u”, and a consonant is all other letters. In addition, put in a statement that catches and prints out that “y” is either a consonant or a vowel.

Example input:

Please give a letter: aa

Please enter only one letter: a

Example output:

Your letter a is a vowel.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: Dear student kindly find your solution below. Let me know if any issue. Thanks.

Please check indentation before run.

Python code:

letter = input("Enter a letter: ") #prompt for a letter
c = 0 #counter to count characters
for i in letter:#for loop in letter
c=c+1#counter increment
if c>1:#check counter
print("Input one letter only")
letter = input("Enter a letter: ")#again ask for letter
if(letter=='a'or letter=='i'or letter=='o'or letter=='u'):#check if vowel
print("It's a vowel")
else:
print("It's a consotant")
  

Add a comment
Know the answer?
Add Answer to:
Write a Python program to check whether a character entered as input is a vowel or...
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
  • Write a C++ Program to Check Whether a character entered by user is Vowel or Consonant.

    Write a C++ Program to Check Whether a character entered by user is Vowel or Consonant.

  • in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels...

    in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant. Here is a sample run: 4.10 Enter a letter: B B is a consonant -Enter Enter a letter grade: a is a vowel Enter Enter a letter grade: # is an invalid input Enter (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and...

  • Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run...

    Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run the program for two vowels, two consonants, and two invalid characters. Assume letters A/a , E/e , I/i , O/o , U/u as the vowels. Write a program that prompts the user to enter a letter and check whether the letter is a vowel or constant.

  • Write a C program to “de-vowel” an input string. Assume that the user provides input containing...

    Write a C program to “de-vowel” an input string. Assume that the user provides input containing only the characters a through z (i.e., all lowercase letters). Your program should create an output string that deletes all vowels from the input string, pushing the letters together to fill any gaps. For example, given the input “theturtleandthehare” your code should print out “thtrtlndthhr”. Your program should create an output string from the input string, before printing its output. Sample Input: Enter a...

  • Write a program in python that asks the user to input a sentence. The program will...

    Write a program in python that asks the user to input a sentence. The program will ask the user what two letters are to be counted. You must use a “for” loop to go through the sentence & count how many times the chosen letter appears in the sentence. You are not allowed to use python built-in function "count()" or you'll get a Zero! Output will show the sentence, the letter, and the number of times the letter appears in...

  • 1. Write a python program that reads a file and prints the letters in increasing order...

    1. Write a python program that reads a file and prints the letters in increasing order of frequency. Your program should convert entire input to lower case and only counts letters a-z. Special characters or spaces should not be counted. Each letter and it's occurrences should be listed on a separate line. 2. Test and verify your program and it's output. ---Please provide a code and a screenshot of the code and output. Thank you. ----

  • 1. Write a program that takes a number as input and check whether the number is...

    1. Write a program that takes a number as input and check whether the number is positive, negative or zero. 2. Write a C++ program that prompts the user to enter a number and checks whether the entered number is even or odd. 3.  Using switch-case statement write a C++ program that prompts the user to enter 1, 2 or 3 and display "Red" if selection is 1, "Yellow" if selection is 2, or "Green" if selection is 3. 4. Write...

  • Using python Question 13 (20 points) Write a function named Linestats that finds the number of...

    Using python Question 13 (20 points) Write a function named Linestats that finds the number of consonant and vowel letters on each line of a file and writes those statistics to a corresponding line of a new file, separated by a space. Definitions: A vowel letter is one of a, e, i, o, u, along with the corresponding uppercase letters..A consonant letter is not a vowel letter. The function linestats takes two parameters: 1. inFile, a string, the name of...

  • Write a program whose input is a string which contains a character and a phrase, and...

    Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times the character appears in the phrase. Ex: If the input is: n Monday the output is: 1 Ex: If the input is: t this is a sentence with many t's the output is: 4 PLEASE WRITE USING PYTHON

  • // Write a program that determines how many of each type of vowel are in an...

    // Write a program that determines how many of each type of vowel are in an entered string of 50 characters or less. // The program should prompt the user for a string. // The program should then sequence through the string character by character (till it gets to the NULL character) and count how many of each type of vowel are in the string. // Vowels: a, e, i, o, u. // Output the entered string, how many of...

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