Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions