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
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