Answered step by step
Verified Expert Solution
Question
1 Approved Answer
def areElementsInList ( list 1 , list 2 ) : ' ' ' This function takes two lists as its parameters ( list 1 and
def areElementsInListlist list:
This function takes two lists as its parameters list and
list Return True if each element in list exists in list
Return False otherwise. If list contains no elements, True is
returned.
# COMPLETE FUNCTION DEFINITION HERE
assert areElementsInListone"one","three" True
assert areElementsInList True
assert areElementsInList False
assert areElementsInList True
def alternateCases:
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 alternateCaseThis is a Sentence" "tHIS IS A sENTENCE"
assert alternateCaseCScs
assert alternateCase
def getCharacterCounts:
This function takes a string parameter s and returns a dictionary
type where each key in the dictionary is a unique uppercase 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
x getCharacterCountThis is a Sentence"
assert xgetS
assert xgetP None
assert xgetI
assert xget
y getCharacterCountPi is Approximately
assert yget
assert ygetA
assert ygetP
assert yget
assert yget None
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started