Question: This is python programming question. Please follow the restrictions. This is python programming question. Please follow the restrictions. This is python programming question. Please follow

This is python programming question. Please follow the restrictions.

This is python programming question. Please follow the restrictions.

This is python programming question. Please follow the restrictions.

This is python programming question. Please follow the restrictions. This is python

programming question. Please follow the restrictions. This is python programming question. Please

nat Tools Add-ons Help Last edit was seconds ago ormal text Arial 11.5 + BIU A 1 III 2 1 1 2 3 4 5 6. 7 8 9 10 11 12 13 14 1 151 17 18 RESTRICTIONS Only allowed: variables, if statements, while loops. Functions: len(), int(), float(), type (), isinstance (), abs (). String methods: format(), isalpha (), lower(), upper (). List operators and methods: create [ ], list(), append(). Keywords: elif, else, return, break, continue, def, self, None, try, raise, except, finally, is, import sys. Any exception handling. Remember: Do NOT use for loops or the in keyword. Do NOT use min () /max(), enumerate ()/zip() or sorted(). Do NOT use negative indexing (e.g. ls(-1]) or slicing (e.g. (1:1). Do NOT use any other list operations or string methods. Marks will be deducted. A consonant digraph is a sound represented by a pair of (exactly two) consonants, such as sh, gr and bl in the English language. Write a function find_shortest() that takes as input a list and a consonant digraph, and outputs the shortest string in the list containing the digraph. To simplify matters, for the purposes of this question, you may assume that all letters in the English alphabet except a, e, i, o and u are consonants, and that any non-repeated pairing of the consonants is a valid digraph. You may also assume that the input list is always a list of strings containing only lowercase letters of the English alphabet a to z. If the input digraph is not a string, raise a TypeError with the message Unexpected input data type. If the input string is not a valid digraph, raise a valueError with the message Invalid digraph. . If more than one string of the same longest length exists, return the first one. If no such string exists, return an empty string '. Examples: find_shortest(['church', 'c', 'etch'], 'ch') # 'etch' find_shortest(['hash', 'bash'], 'sh') # 'hash find_shortest(['trail', 'garage'], 'gr') find_shortest([], 'br') find_shortest(['shell', 'ash'], 12) # TypeError find_shortest(['trampoline', 'actor'], 't') # ValueError find_shortest(['lasso', 'less'], 'ss') # ValueError find_shortest(['bismuth'], 'bi') # ValueError find_shortest(['shrill', 'ash'], 'shr') # ValueError

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 Databases Questions!