Question: Im supposed to create a function arg1 arg2 def compare_back(('c', 'u', 'p', 'b', 'o', 'a', 'r', 'd'),('b', 'u', 'c', 'k', 'b', 'o', 'a', 'r', 'd')):

Im supposed to create a function

arg1 arg2

def compare_back(('c', 'u', 'p', 'b', 'o', 'a', 'r', 'd'),('b', 'u', 'c', 'k', 'b', 'o', 'a', 'r', 'd')):

we can compare either 2 strings, 2 tuples or 2 lists

and the function is supposed to return the number of characters that are in both parameters but we stop the counter when we get to a specific character and do the comparison and the other tuple isnt the same

so like for this example we would return 5 because we start from index -1 and go in descending order and so we see d vs d, r vs r, a vs a until we get to k vs p which is viewing index -6 on both strings and everything else is indentical so we would return 5

another example

arg1 = 'Hello world!' arg2 = 'Hello world! This is an interesting string.'

with those two strings it should return 12 thats including the space as a character in between Hello and World

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!