Problem 2 (6 points) Part A (3 points) Write a function called find not duplicate which accepts a list of objects as inp

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Problem 2 (6 points) Part A (3 points) Write a function called find not duplicate which accepts a list of objects as inp

Post by answerhappygod »

Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 1
Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 1 (28.81 KiB) Viewed 30 times
Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 2
Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 2 (40.67 KiB) Viewed 30 times
Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 3
Problem 2 6 Points Part A 3 Points Write A Function Called Find Not Duplicate Which Accepts A List Of Objects As Inp 3 (24.29 KiB) Viewed 30 times
Problem 2 (6 points) Part A (3 points) Write a function called find not duplicate which accepts a list of objects as input parameter. The function should return a list of objects, which appears only once in the list. For example, if the following list ['John', 'Hary', 'Peter, John', 1.2, 5.8, "Peter', 'Cape Town', 'New York', 299, 5.8, 534] is passed to the function find not duplicate, the following list should be returned: ['Hary, 1.2, "Cape Town', 'New York', 299, 534] a Do not delete this tine. This Line is used in grading your work. INSERT YOUR CODE FOLLOWING THIS LINE; DO NOT ERASE THIS LINE. return final res # Do not delete this line. #Feel free to change delete the following Lines print (find not duplicate(['sohn, Hary', 'Peter, John', 1.2, 5., "Peter', 'Cape Town, New York, 200, 5.8, 534])) print (find not duplicate([John, Mary', 'Cape Town', 'New York', 'Mary', 'Cape Town 1)) In : def find_not_duplicate(myList):

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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply