[Tutor] Sorting numbers
Adam Vardy
Adam Vardy <anvardy@roadrunner.nf.net>
Wed Feb 5 06:37:01 2003
Tuesday, February 4, 2003, 4:27:01 PM, you wrote:
>> Now, we'll take our raw data, and process that into a dictionary using
>> our splitsuffix() function:
>> >>> rawdata
>> ['45K', '100K', '3.4Meg', '17K', '300K', '9.3Meg', '512', '23Meg']
>> >>> srt = {}
>> >>> for item in rawdata:
>> ... num, suffix = splitsuffix(item)
>> ... value = srt.get(suffix, [])
>> ... value.append(num)
>> ... srt[suffix] = value
Can you explain the last three lines here?
--
Adam Vardy