Комментарии:
data = [10,20,20,30,40,50,50]
def remove_duplicate(data, i):
if i >= len(data):
return data
if isinstance(data[i], int):
if data[i] == data[i+1]:
data.pop(i)
return remove_duplicate(data, i+1)
print(remove_duplicate(data, 0))
This program is wrong
ОтветитьIt might be a REAL GOOD IDEA to post the code
ОтветитьYour explanation is not to the point.
Can't understand what are saying.
Thank you very much>>>...
ОтветитьCan't you sort it, loop through the array comparing it to the last element and if so delete that that element/append it if not, to a noduplist. Then it sorts in nlog(n) time and runs in n time. This will run in worst case (n/2)^2. which is worse after 8 elements.
ОтветитьPlease tell me how to remove alternative eliminats in a list
ОтветитьUse this rather maybe if you wanna reduce lines of code:
# Function
remove_duplicates = lambda input_list:list(dict({key:0 for key in input_list}))
# Example/Usage
my_list = [...]
my_list = remove_duplicates(my_list)
You can just convert it to a set and convert it back to a list.
ОтветитьThank you
ОтветитьNice video but...?
How do you delete the '+' in the list below?
My_list=[+1222..., +1838..., 1737...]
but how to remove duplicate with that number for example numbers=[2,2,4,4,6,8,8,9] it will be unique =[6,9] . how to solve that problem?
Ответитьnice
ОтветитьSir pls.. say sir
Noduplist is a empty list
But how we check if the element present in noduplist or not...
Sir what is the output for 1-2,2-3,3-4,4-5
ОтветитьIt would be great if you could show how to do it withouth the "not in" method. That is what I am trying to do. I am trying to loop through "unique" and if "i" is not equal to "j" then I append i to unique. However, I am doing something wrong sintaxis wise.
Ответитьi swear i love u bro
ОтветитьIt's not working in my system. Error says function object not iterable
ОтветитьCan we count the duplicate numbers In a list without using count built-in function?
I want an output like...
(Number, repeated x times)
Thanks sire u helped me a lot😘😘😘
Ответитьthank you so much it solved my assignment
ОтветитьAwsm❤️
ОтветитьYOU SAVED MY LIFE!!!!!!!
ОтветитьFor elements in duplist likhna jaruri hai kya ?
ОтветитьYou made your code so complex you could just convert the list to sets and all duplicates would be gone
ОтветитьThis program question is asked in every interview
Ответитьwhen I heard an Indian accent I knew, I'd learn something today.
ОтветитьThanks
Ответить👍👍👍
ОтветитьWe can convert the list into set to remove duplicates
ОтветитьSir ye har value ke liye kam nhi krega.
While loop se krye ek baar
Bro u put that duplicate list into set datatype and you again convert the set to the list data type and print the list like this
List1=[ 1,5,6,4,2,3,3,3]
Set1=set(list1)
List1= list(set1)
Print(list1)
Thanks sire u helped me solve my assignment 🇳🇬💗💗
ОтветитьThank you. I appreciate your Support for the Community.
ОтветитьIs this even efficient?
ОтветитьI am trying to print also the noduplist by the console tells me that it is not defined. What should I do ??
Ответитьthank you, dawg. appreciate ya
Ответитьfor loop would be performance killer if we have a big list...
ОтветитьThis is really helpful
ОтветитьNice work
Ответить