Basta Fazoolin exercise

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 f"The {self.name} menu is available from {self.start_time}:00 to {self.end_time}:00." brunch_items = { '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("Brunch", brunch_items, 11, 16) early_bird_items = { '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_items, 15, 18) dinner_items = { '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("Dinner", dinner_items, 17, 23) kids_items = { 'chicken nuggets': 6.50, 'fusilli with wild mushrooms': 12.00, 'apple juice': 3.00 } kids = Menu("Kids", kids_items, 11, 21) print(brunch)

Run this code, it shows this error:
File “main.py”, line 4
self.items = items
^
SyntaxError: invalid syntax
I think the error is not supposed to be there.
Can someone please tell me how to fix the error because this is my progress on a project which is called Basta Fazoolin. The project is on a course called Learn Python 3 and it is in the topic classes.
I have watched the project walkthrough and I have changed my code a bit. One of the changes was putting one of the arguments of the instantiated variable into a variable and using that variable as the corresponding argument. I have typed my problem into the bugs help section briefly. I am currently waiting for a response. I am on task 8 currently. I have encountered some different errors on task 8 already. I have tried to fix the errors and some of the errors encountered were fixed but the error above is still unfixed(when I wrote this post). Please can you answer my questions(if you know the answer).Thank you.

Hello! Look at line 2. You’ll see your function definition:

def __init__(self, name, items, start_time, end_time:

Is it missing anything?

Hint

Look at the end of the declaration. Should there be anything between end_time and :?

1 Like

A ) should be between end_time and :

print("Thank you codeneutrino. Thank you for helping me fix my bug.")
1 Like
some_list = ['N', 'o', ' ', 'p', 'r', 'o', 'b', 'l', 'e', 'm', '!'] a = "" for i in some_list: a+=i print(a)
# Compliment code: # Importing the randint function from the random function: from random import randint # Creating a variable called text that represents the text That code looks interesting text = "That code looks interesting." # Creating a variable called rand_num that is any random integer from 1 to 12: rand_num = randint(1, 12) # Sets a loop that repeats the code indented rand_num times: for i in range(rand_num): # Prints the text each time: print(text)

Please appreciate my time writing this code. I spent more than 5 minutes writing the code.
I wrote this to @codeneutrino(I am saying this because I accidently didn’t make this post a reply to @codeneutrino(I tried to but I failed))

That’s very nice! I like your use of comments as well!

getting a SyntexError at stage 15 and cannot get past it any ideas please?

SyntexError
Traceback (most recent call last):
File “script.py”, line 54, in
flagship_store = Franchise(‘1232 West End Road’, menus)
TypeError: object() takes no parameters

When you define an __init__() method, there has to be two underscores (_) on each side. Check here:

Does this look right?

1 Like