Python Forum
Exercise list remove duplicates
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exercise list remove duplicates
#3
(Oct-23-2019, 01:42 PM)ichabod801 Wrote: Define "doesn't work." I'm not sure what the parameter to the function call is supposed to be, as you write over whatever it is on line 10. But if you pass something as a parameter, it works for me. Note that it is printing out the list before dupes are removed, and returning the list with dupes removed. So it may look wrong, but if you check the return value it's correct.

When I added this above function and compiled my code :
list_input = input()
print(create_set(list_input))
Didn't show me nothing as if it didn't read my script.

This is my all code:
def create_set(list_create):
    user_input = input("Insert elements: ") 
    list_create = list(map(int,user_input.split(',')))
    print(list_create) 
 
    return list(set(list_create))



list_input = input()
print(create_set(list_input))
Reply


Messages In This Thread
Exercise list remove duplicates - by RavCOder - Oct-23-2019, 12:24 PM
RE: Exercise list remove duplicates - by ichabod801 - Oct-23-2019, 01:42 PM
RE: Exercise list remove duplicates - by RavCOder - Oct-23-2019, 01:55 PM
RE: Exercise list remove duplicates - by ichabod801 - Oct-23-2019, 02:19 PM
RE: Exercise list remove duplicates - by RavCOder - Oct-23-2019, 02:40 PM
RE: Exercise list remove duplicates - by jefsummers - Oct-23-2019, 02:58 PM
RE: Exercise list remove duplicates - by RavCOder - Oct-23-2019, 03:06 PM
RE: Exercise list remove duplicates - by jefsummers - Oct-23-2019, 03:30 PM
RE: Exercise list remove duplicates - by RavCOder - Oct-23-2019, 03:36 PM
RE: Exercise list remove duplicates - by jefsummers - Oct-23-2019, 04:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to sort a list with duplicates and return their unique indices. Echoroom 3 3,785 Sep-23-2022, 07:53 AM
Last Post: deanhystad
  help with adding duplicates elements together in a list 2ECC3O 5 2,214 Sep-10-2022, 07:11 AM
Last Post: 2ECC3O
  How to remove extra space from output list? longmen 3 1,994 May-05-2022, 11:04 PM
Last Post: longmen
  Dealing with duplicates to an Excel sheet DistraughtMuffin 6 3,455 Oct-28-2020, 05:16 PM
Last Post: Askic
  duplicates nsx200 3 2,579 Nov-12-2019, 08:55 AM
Last Post: nsx200
  how to take out duplicates from a list? helpme 2 2,608 Mar-08-2019, 02:27 PM
Last Post: ichabod801
  Remove special character from list vestkok 3 4,409 Nov-04-2018, 01:48 PM
Last Post: ichabod801
  How to keep duplicates and remove all other items in list? student8 1 5,089 Oct-28-2017, 05:52 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020