# Create displayList
displayList = []
# 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:
...
displayList=[]
levelsList=[3,4,5,6,7,85,34]
for i in range(0,len(levelsList)):
subList=[]
priceLevelLabel=["Price Level",levelsList[i]]
spacePrice=' '.join(map(str, priceLevelLabel))
print(spacePrice)
subList.append(spacePrice)
displayList.append(subList)
print(displayList)
Comments
Leave a comment