Question: def show _ list ( self ) : line _ base _ len = len ( ' TOTAL ' ) - 4 max _ item

def show_list(self):
line_base_len = len('TOTAL')-4
max_item = max(len(item.name) for item, _ in self.app_engine.shopping_list.list)
line_base_len = max(max_item, line_base_len)
total = Item('TOTAL', self.app_engine.shopping_list.get_total_price())
max_order = total.get_order()
max_name = len(total.name)
out = 'SHOPPING LIST
'
i =0
for i,(item, quantity) in enumerate(self.app_engine.shopping_list.list):
hide_price = self.app_engine.mask_index == i
padding = line_base_len - len(item.name)
out += item.get_list_item_str(quantity, True)+'......'+ item.get_price_str(quantity)+'
'
i +=1
hide_price = self.app_engine.mask_index == i
q_len =5
d_len =2
total_line = total.get_list_item_str()+'......'+ total.get_price_str(True)+'
'
hline ='-'* len(total_line)+'
'
return out + hline + total_line +'
' my code is not producing right output[RULE] The 'AppCLI' class has the 'run', 'execute_command', 'process_show', 'process_ask', 'show_items', and 'show_list' methods that work correctly.
[RESULT] FAILED (2)
[FEEDBACK] Given the 'show list' command, the 'app_engine.message' is assigned 'SHOPPING LIST'
apple (1x) $2.00
banana (1x) $4.00
jam (1x)$6.00
lemon (1x) $3.00
orange (1x)$1.00
walnut (1x) $5.00TOTAL $21.00
whereas it should be assigned 'SHOPPING LIST
apple (1x)dots.$02.00
banana (1x)... $04.00
jam (1x)dots..$06.00
lemon (1x).... $03.00
orange (1x)dots$01.00
walnut (1x)... $05.00
TOTAL .......... $21.00
 def show_list(self): line_base_len = len('TOTAL')-4 max_item = max(len(item.name) for item, _

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!