May-02-2018, 10:57 AM
Hello Everyone,
This is my first time posting here but I am trying to import this class on to the interpreter and it keeps telling me I have a syntax error but I just can't see it. This is from a course on youtube I am following, Thanks to anyone that helps here is the code:
The error is showing up on line 28 just before the last bracket
This is my first time posting here but I am trying to import this class on to the interpreter and it keeps telling me I have a syntax error but I just can't see it. This is from a course on youtube I am following, Thanks to anyone that helps here is the code:
class Tab: menu = { "wine": 5, "beer":3, "soft_drink": 2, "chicken":10, "beef":15, "veggie":12, "dessert":6 } """docstring for Tab.""" def __init__(self): self.total = 0 self.items = [] def add(self, item): self.items.append(item) self.total += self.menu[item] def print_bill(self,tax,service): tax = (tax/100) * self.total service = (service/100) * self.total total = self.total + tax + service for item in self.items: print(f'{item} £{self.menu[items]}') print(f'{"Total"} £{total:.2f}')The way I am calling this is with: from name_of_file import Tab.
The error is showing up on line 28 just before the last bracket