Re: heap enhancements

2020-01-04 Thread Peter Otten
jezka...@gmail.com wrote: > ok, so it could be like this? Easy things to improve: (1) Avoid iterating over indices. Wrong: for i in range(len(stuff)): item = stuff[i] ... Better: for item in stuff: ... (1a) If you need the index use enumerate(): for i, value in enumerate(stuff

Re: heap enhancements

2020-01-03 Thread jezkator
ok, so it could be like this? import sys chain = sys.stdin.read().splitlines() array_z = list() for line in chain: row=list(map(str, line.split())) array_z.append(row) #every line in input changes into 2D array def checking(chain): "checking if characters are numbers or not" for c

Re: heap enhancements

2020-01-03 Thread DL Neil via Python-list
On 4/01/20 2:13 PM, rontoto wrote: Hi guys, the code is working, but I want know, what I can improve on this code. It is like implementation of the simulation of shipment clearance in the depot according to priority and available deliveries. How can I do it better? Can u show me? Thnx for your

heap enhancements

2020-01-03 Thread rontoto
Hi guys, the code is working, but I want know, what I can improve on this code. It is like implementation of the simulation of shipment clearance in the depot according to priority and available deliveries. How can I do it better? Can u show me? Thnx for your time. Input: 24 K 13 H 25 R 1 M -4