def lowest(aList,ignoreThis): #Purpose: to find the position of the lowest item in aList #Parm 1: aList is a list of strings (not numbers) #Parm 2: ignoreThis must be "" i.e. nul #Result: returns the position of the lowest item # in aList #strings == ignoreThis are to be ignored #NB any nul entries in aList will be eliminated #NB the calling program must set the # lowest item to ignoreThis after each iteration #print("into lowest") #print("aList:",aList) #print("ignoreThis:",ignoreThis) posLowest=-1 if aList==(""): print("Error aList contains 1 null item") return posLowest #if end if len(aList)==0: print("aList is empty") return posLowest lowest=ignoreThis #print("lowest:",lowest) posThis=-1 #print("find first item that is not null") rList= range(len(aList)) for i in rList: #print("i:",i) if aList[i]>ignoreThis: #print(">") lowestItem=aList[i] posThis=i else: #print("not >") Doh="" #if end #print("posThis:",posThis) if posThis== -1 : Doh="!" #print("Error: Nothing > nul is in aList.") #if end #print("Good: posThis is position of a non-null item") #for end #print("posThis:",posThis) if posThis==-1 : #print("Done: aList contains all null entries") return posLowest else: Doh="!" #print("found at least one non-null item at position posThis:",posThis) #print("continuing to find lowest (or equal) non-null item") #return posThis #print("Now look for a lower (or equal) non-null item...") #print(". . . not coded yet . . .") for i in rList: #print("i:",i) if aList[i] == ignoreThis : Doh="!" else: if aList[i]<= lowestItem: lowestItem=aList[i] posThis=i #print("new lowestItem:",lowestItem) #if end #if end #for end #if ignore=-1 #returns the position of the lowest item in aList # aList #ignoring all items = ignoreThis #returns -1 if no lowest item is found #try using return posThis #def end