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
#5
(Apr-23-2017, 07:06 PM)volcano63 Wrote:
(Apr-23-2017, 12:32 PM)idontreallywolf Wrote: Well, you will have to follow some steps:

1. instead of using 2 lists (FirstName & LastName) you could just create a dictionary and put Firstnames and Lastnames in it.
example: Names = {'Anna':'Zenoff','Manny':'Ryan'} and then you could create a list, call it Final.

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.
Reply


Messages In This Thread
RE: Sorting ID with first and last name Arrays - by idontreallywolf - Apr-23-2017, 08:29 PM

Forum Jump:

User Panel Messages

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