## Question 6: first_duplicate function (8 marks) Write a function called first_duplicate that takes a list as an argume

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

## Question 6: first_duplicate function (8 marks) Write a function called first_duplicate that takes a list as an argume

Post by answerhappygod »

## Question 6: first_duplicate function (8 marks) Write a
function called first_duplicate that takes a list as an argument
and returns the first element that is duplicated in the list. If no
duplicates are found, the function should return None. Hint: One
way of doing this is to use the count method to see how many
instances of each element there are. If there is more than 1, it
means that that element is duplicated. Write code to test the
function first_duplicate with a list of numbers and a list of
tuples. If your function does not work with both types, then change
it until it does work with these two types.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply