Question: Problem 1 . If s is a string object, s . replace ( u , v ) returns a string with all occurrences of u

Problem 1. If s is a string object, s.replace(u, v) returns a string with all occurrences of u in s replaced with v, and s.count(u) returns the number of occurrences of u in s. For example, "abba".replace("b","a") returns "aaaa", "abba".count("b") returns 2, and "abba".count("z") returns 0. Consider the following functions:
a. What does f("abracadabra","a") return?
A " br c d br "
B "abrcdbr"
C "brcdbr"
D "bracadbr"
E "abracadabra"
b. What does len(f("abracadabra","b")) return?

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