Question: Create functions that complete all the descriptions in red IN PYTHON. def areElementsInList(listi, list2): This function takes two lists as its parameters (list1 and
Create functions that complete all the descriptions in red IN PYTHON.
def areElementsInList(listi, list2): "" This function takes two lists as its parameters (list1 and list2). Return True if each element in listi exists in list2. Return False otherwise. If listi contains no elements, True is returned. # COMPLETE FUNCTION DEFINITION HERE assert areElementsInList( ["one",2], [0,"one",2,"three"]) == True assert areElementsInList([],[1,2,3,4]) == True assert areElementsInList([1,2,3],[1,2]) == False assert areElementsInList([1,2,3], [3,2,1]) == True def alternateCase(s): "This function takes a string parameter (s) and returns a new string that flips the case of each alpha character in s. # COMPLETE FUNCTION DEFINITION HERE assert alternateCase("") == assert alternateCase("This is a Sentence") == "THIS IS A SENTENCE" assert alternateCase("CS9") == "c59" assert alternateCase("9.95") == "9.95" def getCharacterCount(s) : "This function takes a string parameter (s) and returns a dictionary type where each key in the dictionary is a unique upper-case character in s and its associated value is the number of occurences the unique character exists in s. Note that the unique characters should be case insensitive ("a" and "A" are considered the same and should be stored as "A" in the dictionary). Non alpha characters (including whitespaces) and their occurences should also be stored in the dictionary. # COMPLETE FUNCTION DEFINITION HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
