Answer to Question #240137 in Python for win

Question #240137

# 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


1
Expert's answer
2021-09-22T00:05:12-0400
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])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS