Question
Question 1 The purpose of this question is to write a program that grabs a list, recognizes and removes the duplicated items. To answer this
Question 1 The purpose of this question is to write a program that grabs a list, recognizes and removes the duplicated items. To answer this question, write a function that first ask the user to enter the length of an optional list. Then, grabs the elements of the list one by one.
def grabList():
Afterwards, then write another function that search inside that list element by element and find the duplicated items.
def listSearch():
In this function if an element is occurred more than one time, it should be recognized by the program and increase its frequency of occurrence. In order to remove the duplicated items, write another function:
def delDup():
This function will search in the frequency of occurrence of each element and delete the ones that their frequency of occurrence is more than one.
All these functions can be called either in a main () function or in a main code body. Note : The code should be able to mention which element(s) was duplicated and remove from the final list. ------------------------
The output of the program
Enter the length of the list: 4
Enter element 1: 12
Enter element 2:2.4
Enter element 3: a
Enter element 4: 2.4
The final list is: [12,a]
The element 12 occurs 1 time at 0.
The element 2.4 occurs 2 times at 1,3 => it is removed
The element a occurs 1 time at 2.
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