Question: lower() - A lowercase version of string .upper() - An uppercase version .replace(old,new) - A new version of string in which every occurrence of the
lower() - A lowercase version of string .upper() - An uppercase version .replace(old,new) - A new version of string in which every occurrence of the substring old is replaced by the string new. .count() - method is used to count the occurrences of a specific element in a sequence ''' sentence = "'Dog' 'Outlet' 'dodge' 'Dog' 'frame' 'Chair' 'eBook' 'Cat' 'Chair' 'Frame' 'Computer' 'pc' 'Dodge' 'Pc' 'Dog' 'cat' 'PC' 'dog'" #Replace the single quotes with an empty string in @var sentence and, #convert to lowercase, assign to @var myString.#count the number of times the word dog appears in myString, assign to #@var dogCount #count the number of times the word pc appears in myString, assign to #@var pcCount#print "Dog Count: PC Count: "#print myString
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
