Question

In: Computer Science

Write Python code that checks if an existing variable letter is a lowercase vowel. If it...

Write Python code that checks if an existing variable letter is a lowercase vowel. If it is a, e, i, o, or u and print out "Yes, it is a lowercase vowel". If the letter is y, print out "The letter is a consonant". If the letter is anything else, print out "No, the letter is not a vowel".

(language python)

Solutions

Expert Solution

CODE:

ch = input("Enter a character: ")
if ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u':
    print("Yes, it is a lowercase vowel")
elif (ord(ch) >= 65 and ord(ch) <= 90):
    print("No, the letter is not a vowel")
else:
    print("The letter is a consonant")

SCREENSHOTS::


Related Solutions

Write if logic in Python that checks if a variable named number is either greater than,...
Write if logic in Python that checks if a variable named number is either greater than, less than , or equal to 10 and prints out the number with the appropriate message, for example, if number is 6 you would output: number,"less than 10" or 6 less than 10
Write a code to find the following in a text file (Letter). language: Python (a) Find...
Write a code to find the following in a text file (Letter). language: Python (a) Find the 20 most common words (b) How many unique words are used? (c) How many words are used at least 5 times? (d) Write the 200 most common words, and their counts, to a file. text file: Look in thy glass and tell the face thou viewest, Now is the time that face should form another, Whose fresh repair if now thou not renewest,...
Problem 2(a). Letter Frequencies. ? Write Python code that reads a text file into memory and...
Problem 2(a). Letter Frequencies. ? Write Python code that reads a text file into memory and creates a dict object with a frequency count for each letter. For example, for encryptedA.txt, your output should contain the key:value pairs 'a': 78 and 'b': 31. Notes Do not distinguish between uppercase and lowercase letters. Ignore punctuation. Punctuation counts must not appear in your dict If a given letter does not appear in the text, there must be a key:value pair with value...
C++ Write a program that reads a line of text, changes each uppercase letter to lowercase,...
C++ Write a program that reads a line of text, changes each uppercase letter to lowercase, and places each letter both in a queue and onto a stack. The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward or backward). Please use a Queue Class and Stack class.
python: Write a program that turns a sentence into camel case. The first word is lowercase,...
python: Write a program that turns a sentence into camel case. The first word is lowercase, the rest of the words have their initial letter capitalized, and all of the words are joined together. For example, with the input "fOnt proCESSOR and ParsER", your program will output "fontProcessorAndParser". Optional: can you do this with a list comprehension? Optional extra question: print a warning message if the input will not produce a valid variable name. You don't need to be exhaustive...
For the side-chains of the 20 amino acids. Write the 1-letter code and the 3-letter code...
For the side-chains of the 20 amino acids. Write the 1-letter code and the 3-letter code for each, in groups according to side-chain characteristics (eg. hydrophobic, polar with S or O containing functional groups, and polar with N containing functional groups).  For the amino acids listed, state whether the amino group, the acid group and the side-chain group will be significantly protonated, unprotonated or ~50% protonated at the following pH values: pH= 2.6, 4.8, 6.6, 7.4, 8.4, 9.2, 10.0. Also indicate...
Write a python code using a continuous random variable and using uniform distribution to output the...
Write a python code using a continuous random variable and using uniform distribution to output the expected weight of students in a class.
In PYTHON: Write a program that asks for a password from a user and checks if...
In PYTHON: Write a program that asks for a password from a user and checks if it satisfies the conditions: Contains at least one lowercase letter (a-z). Contains at least one uppercase letter (A-Z). Contains at least one digit (0-9). Minimum length 6 characters. Contains no spaces. If the password is valid, then the program prints “password accepted”. Otherwise, it keeps asking for more passwords from the user until a valid password is obtained. Hint: You might like to check...
*Code in C* Write a function that checks if a number is a perfect cube. Write...
*Code in C* Write a function that checks if a number is a perfect cube. Write another function that calculates the integer cubic root. Under the main program: Prompt the user to input a number Tell the user if the number is a perfect cube or not Print the cubic root if the inputted number is a perfect cube.
write a statement to guarantee that the initial will be a capital letter. write the code...
write a statement to guarantee that the initial will be a capital letter. write the code in jsGraph
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT