Apr 17, 2018
Peugeot Service Box (DocBackup + Sedre) (11.2013) Keygen Torrent Sedre 09/2011 -. 1. .
Hi,i need the key for peugeot Service DocBackup i Sedre 09/2011 language: Spain. Here you find Citroen and Peugeot Sbox 2011.09 keygen.
Peugeot Service Box (DocBackup + Sedre) (11.2013)+Keygen TORRENT.. Keygen Peugeot Service Box exe.. peugeot service box keygen download .
Q:
Speeding up a loop in Python
I'm trying to improve the following loop, but can't figure out how. In the code below, I need to find the highest frequency from a list of lists. For example:
test=[[2,1],[1,2]]
highest=0
for i in test:
for k in test:
if k>i[0]:
highest=k
break
print(highest)
Since the loop is going through the list multiple times, I assume it's rather slow. I'm new to python and I have no idea how to optimize this. I can't use numpy for this, as this is part of a lecture, and we're not allowed to use numpy yet. Any help would be appreciated. Thanks!
A:
How about sorting the list first:
>>> test = [[2, 1], [1, 2]]
>>> sorted(test, key=lambda i: i[0])
[(1, 2), (2, 1)]
>>> [max(s) for s in sorted(test, key=lambda i: i[0])]
[1, 2]
>>>
If the items in the list are unique then you can try using a set:
>>> set(sorted(test, key=lambda i: i[0]))
{(1, 2)}
You should probably consider asking someone to review your code if you're not able to figure out how to improve it ac619d1d87
Related links:
Comments