Answer to Question #242676 in Python for Yami

Question #242676
# Loop through the prices in levelsList.
# During each loop:
# - Create a variable called priceLevelLabel consisting of the text 'Price Level:    ' followed
#   by the price.
# - Add priceLevelLabel and the price as two separate items to a new list (the sub-List).
# - Append the sub-List to displayList.
for price in self.levelsList:
    ...

# Create a variable called previousPriceLabel consisting of the text 'Previous Price: ' followed
# by previousPrice.
# Add previousPriceLabel and previousPrice as two separate items to a new list (the sub-List).
# Append the sub-List to displayList.
...

# 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.
...




1
Expert's answer
2021-09-27T01:54:57-0400
for price in self.levelsList:
    priceLevelLabel = 'Price Level: ' +str(price) 
    sub_List = [priceLevelLabel, price]
    displayList.append(sub_List)
    currentPriceLabel  = 'Current Price: '+str(currentPrice)
    sub_List1 = [currentPriceLabel, currentPrice]
    displayList.append(sub_List1)

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