Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 1 : Sets.py a ) Prompt the user to enter an input sentence e . g . Did you hear about the one -

Program 1:
Sets.py
a) Prompt the user to enter an input sentence e.g. "Did you hear about the one-eyed one-horned Flying Purple People Eater?" and save it in a variable named sentence. Your sentence must contain special characters as well, for example, "?" or "-" here. Convert the input sentence into a list format. [20% marks]
b) Write a function named checkvowelsConsonants() that contains the logic to check the number of vowels and consonants in the input. Do not write separate functions for vowels and consonants. Keep in mind that your input contains special characters (which are not alphabets), therefore, they should not be wrongly identified as vowels or consonants. The expected output for the above sentence is: "The number of vowels is 26 and consonants is 31".[30% marks]
c) Looping indefinitely (Hint: use infinite while loop), the program should give the user the 2 options given below and allow the user to select one among them. [20% marks]
Print the number of vowels and consonants
exit the program
d) Use a set to store the vowels A, E, I, O, U, a, e, i, o, u.[10% marks]
e) When the user selects option 1, print the number of vowels and consonants in the input sentence. [10% marks]
f) When the user selects option 2, allow the user to exit the program. Use 'break' to stop the infinite while loop. [10% marks]
g) Write appropriate function calls for the proper working of the function checkvowels Consonants().
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

3. Did you seek anyones advice?

Answered: 1 week ago