Python Forum
Sorting ID with first and last name Arrays
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorting ID with first and last name Arrays
#6
(Apr-23-2017, 08:29 PM)idontreallywolf Wrote:
(Apr-23-2017, 07:06 PM)volcano63 Wrote: And if the first name shows more than once in the first list? We have a beautiful zip for meshing lists
for first_name, last_name in zip(fristName, lastName):
I am not sure if 2 lists were a given - or it's OPs idea, but using dict the way you suggested here is definitely wrong

Well, then educate me brother. Why is using dict wrong? - in this case.
I usually try to be polite - but since I'm a brother, let me treat you like a family Evil

You gave a useless advice, that adds nothing to the solution.

  1. For starters, dict has unique keys - thus my hint about more than once, which you missed.
  2. Suggesting manually writing dictionary instead of two lists has no merit  Wall - OP could have written full name from the start.
  3. You cant apply intto list slice - and why are you creating a list of strings if you want to sort it by integer component?
You suggested "solution" is a mess - so litter box is suggested Naughty
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Messages In This Thread
RE: Sorting ID with first and last name Arrays - by volcano63 - Apr-23-2017, 09:40 PM

Forum Jump:

User Panel Messages

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