Problem 2 (6 points) Part A (3 points) Write a function called find not duplicate which accepts a list of objects as inp
Posted: Mon Jun 06, 2022 4:39 pm
Part B (3 points) Write a function called interchange first ste_int which accepts a list of lists, where for each list the elements are either strings or numbers as input parameter, The function must return the input list of lists, in which only the first integer is being substituted by the first string. For example, if the list [[2.8, Rayan', 'Peter', 'sally'], [1.2, 6], [78, Cape Town, New York'], [299, 754, 534]] is passed to the function interchange_first_str_int, the following list should be returned [[2.8, 6, Peter', 'sally'1, [1.2, 'Rayan'], [78, Cape Town, New York'], 1299, 754, 534]] Hint: check out the next Python code cell. In 11: numit S int) num2 5.5. obs silly print(type(nuni) print (type (nunt) print (type(num) print(V) float) str) print (type(nun2) print(type(numz) int) Float) print(type(num2) astr) print peint (type(ob3) sint)) print (type(ob3) float) print(type(obs) stry. def interchange first str int(listin) #Do not delete this time. This time to used to grading your work. INSERT YOUR CODE FOLLOWING THIS LESE DO NOT ERASE THES ZE
Hint: check out the next Python code cell. num2 = 5.5 ob3 = 'silly' print (type(num1) print (type(num1) print (type(num) print("\n') print (type(num2) int) float) str) int) print (type(num2) float) print (type(num2) == str) print("\n') print (type(ob)) a int) print (type(oba) Float). print (type(oba) str) In [ ]: def interchange_first_str_int (listin): # Do not delete this Line. This tine is used in grading your work. #INSERT YOUR CODE FOLLOWING THIS LINE; DO NOT ERASE THIS LINE. return listin # Do not delete this Line #Feel free to change / delete the following Lines al [['John', 'Mary', 'Peter', 'sally'], [1.2, 6], [78, "Cape Town, print("\nModified list:\n', interchange_first_str_int (al)) New York'], [299, 754, 534]] al [[2.8, 'Rayan', 'Peter', 'Sally'], [1.2, 61, [78, Cape Town, New York'], [299, 754, 534]] In [ ]: num = 5