Hello I am stuck on Basta Fazoolin' Task 7

In Task 7 for I keep getting this error
Traceback (most recent call last):
File “script.py”, line 16, in
print(brunch_menu)
TypeError: str returned non-string (type tuple)

print('Hello world!') class Menu: def __init__ (self, name, items, start_time, end_time): self.name = name self.items = items self.start_time = start_time self.end_time = end_time def __repr__(self): return (self.name + "menu available from"+ str(self.start_time), "to"+ str(self.end_time)) brunch={ 'pancakes': 7.50, 'waffles': 9.00, 'burger': 11.00, 'home fries': 4.50, 'coffee': 1.50, 'espresso': 3.00, 'tea': 1.00, 'mimosa': 10.50, 'orange juice': 3.50 } brunch_menu=Menu("Brunch", brunch, 1100,1500) print(brunch_menu) early_bird={ 'salumeria plate': 8.00, 'salad and breadsticks (serves 2, no refills)': 14.00, 'pizza with quattro formaggi': 9.00, 'duck ragu': 17.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 1.50, 'espresso': 3.00, } early_bird=Menu("Early Bird", early_bird, 1500,1800) dinner={ 'crostini with eggplant caponata': 13.00, 'ceaser salad': 16.00, 'pizza with quattro formaggi': 11.00, 'duck ragu': 19.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 2.00, 'espresso': 3.00, } dinner_menu= Menu("Dinner", dinner,1700,2300) kids={ 'chicken nuggets': 6.50, 'fusilli with wild mushrooms': 12.00, 'apple juice': 3.00 } kids_menu= Menu("Kids Menu", kids, 1100,2100)

On line 9, you return a tuple, not a string; the comma between str(self.start_time) and "to" makes them into two separate tuple indices. Concatenate using the + operator instead.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.