I have an array with subjects and every subject has connected time. I want to compare every subjects in the list. If there are two of the same subjects, I want to add the ti
If the elements of subject are hashable:
subject
finalinfo = {} for s, t in zip(subject, time): finalinfo[s] = finalinfo.get(s, 0) + t
This will result in a dict with subject: time key-value pairs.
subject: time