# Create a variable called currentPriceLabel consisting of the text 'Current Price: ' followed # by currentPrice.
# Add currentPriceLabel and currentPrice as two separate items to a new list (the sub-List).
# Append the sub-List to displayList.
. . .
# Sort displayList using the SECOND item (price) in its sub-lists
. . .
# For each sub-List in displayList, print only the label (first item) in the sub-List
. . .
#replace ellipsis with applicable code
currentPriceLabel="Current Price"
bool = True
while bool:
sublists=[s,0]
currentPriceLabel= input()
currentPrice= float(input())
sublists[0]=currentPriceLabel
sublists[1]=currentPrice
displayList.append(sublists)
c= input("Press e to exit Or any any letter to continue; ")
if c=="e":
bool=False
exit()
def Sort(Lists):
Lists.sort(key=lambda x:x[1])
return Lists
Sort(displayList)
for i in displayList:
print(i[0])
Comments
Leave a comment