Problem Set 6(Vowgram)

Q.
Vowgrams are words or sentences that has every vowel of  the English alphabet occurring  at least  once. Write an algorithm and  a subsequent Python code to check whether a string is a vowgram or not. Write a function to check if a given string is a vowgram. For example, "The quick brown fox jumps over the lazy dog" is a vowgram.

Input:
the string

Processing:
def vowgram(s):
    s = s.lower()
    s = ''.join(s.split())
    if set(s) > set('aeiou'):
        print('Vowgram')
    else:
        print('Not vowgram')

Output:
display whether string is a vowgram or not

Program
def vowgram(s):
    s = ''.join(s.split())
    s = s.lower()
    if set(s) > set('aeiou'):
        print('Vowgram')
    else:
        print('Not vowgram')

s= input()

vowgram(s)

Algorithm:
Step1. define the function vowgram with one parameter s
Step1.1 convert all the letters of s into lower case and remove all the whitespace characters
Step1.2 check if set(s) is a superset of the set of vowels if yes then display the string is a vowgram else display not vowgram
Step2. get the string and check whether it is a vowgram or not using the vowgram function
Step3. End


No comments:

Post a Comment

Bonus Practice Problems(GMT To IST)

IST (Indian Standard Time) is 5 hours 30 minutes ahead of GMT(Greenwich Mean Time). Develop an algorithm and write the Python code to find...