Need help with Removing Duplicates from Array

sonal13 singhalishaas60 at gmail.com
Tue Jun 27 12:13:14 UTC 2023


Hey everyone,

I've been encountering some trouble while trying to remove 
duplicates from an array, and I was hoping someone could help me 
out. I came across a tutorial that explains how to remove 
duplicates from an array. Here's the [Remove Duplicates from 
Array 
Tutorial](https://www.interviewbit.com/blog/remove-duplicates-from-array/).

I followed the steps outlined in the tutorial, but I seem to be 
getting unexpected results. Instead of removing duplicates, the 
array remains unchanged. I'm not sure what I'm doing wrong here.

Here's the code snippet I'm using:

```python
def remove_duplicates(arr):
     unique_array = list(set(arr))
     return unique_array
```


I've tried this code with different arrays, but the duplicates 
are not getting removed. Can someone please help me understand 
what I'm missing or suggest an alternative approach to achieve 
this?

I would greatly appreciate any guidance or advice on this issue. 
If you have any other resources or tutorials that provide a 
solution to removing duplicates from an array, please feel free 
to share them as well.

Thank you all in advance.


More information about the Digitalmars-d mailing list