Python Forum
Dict from list - HELP! PLEASE!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dict from list - HELP! PLEASE!
#9
(Apr-08-2020, 01:27 PM)deanhystad Wrote: That is not true. In your first example you created an empty dictionary and you returned a value. You know how to do both of those things, now just put them together. You are overthinking this problem. Think the most obvious answer to the question: How do I return an empty dictionary?

But when I tested my firt code, it's always return a new dict, and if it has a numero duplicated, it will delete the second duplicate value and return a new dict. And I don't know why because my condition return a new dict when 'else'.
Reply


Messages In This Thread
Dict from list - HELP! PLEASE! - by cherry_cherry - Apr-07-2020, 07:15 AM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-07-2020, 09:36 AM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-07-2020, 03:45 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-07-2020, 05:29 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-08-2020, 01:27 PM
RE: Dict from list - HELP! PLEASE! - by cherry_cherry - Apr-08-2020, 02:13 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-08-2020, 03:29 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-08-2020, 04:07 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-08-2020, 05:01 PM
RE: Dict from list - HELP! PLEASE! - by deanhystad - Apr-08-2020, 07:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Input validation for nested dict and sorting list of tuples ranbarr 3 4,094 May-14-2021, 07:14 AM
Last Post: perfringo
  List index out of range when turning CSV into dict ranbarr 15 7,001 May-12-2021, 10:38 AM
Last Post: ranbarr
  Python Adding +1 to a list item cointained in a dict ElReyZero 1 2,188 Apr-30-2020, 05:12 AM
Last Post: deanhystad
  maximum and minimum element from the list and return output in dict MeeranRizvi 1 3,845 Jan-02-2017, 02:12 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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