Question: Write a script that takes a character (i.e. a string of length 1) as input from the user and returns False if it is a

  1. Write a script that takes a character (i.e. a string of length 1) as input from the user and returns False if it is a consonant, True otherwise. A check on the length of the input string and its being alphabetical is required and if not, send a message to the user and ask again.

while True:

#prompts and receives user input

char = input('Please enter an alphabetical character:')

if char.isdigit(): #checks if input is numerical

print ('Invalid input.')

else:

if len(char) > 1: #checks if input is more than one character

print ('Invalid input.')

else:

if char == 'a' or 'e' or 'i' or 'o' or 'u' or 'y': #checks if input is a vowel

print ('True')

else:

print ('False')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!