ImportError: cannot import name 'Tab' from 'bar_tab'

I'm learning python. Trying to do a simple tutorial from youtube. Here is the code:

class Tab:

menu = {
    'wine': 5,
    'beer': 3,
    'soft_drink': 2,
    'chicken': 10,
    'beef': 15,
    'dessert': 6

def __init__(self): = 0
    self.items = []

def add(self, item):
    self.items.append(item) +=[item] 

def print_bill(self, tax, service):
    tax = (tax/100)*
    service = (service/100)* 
    total = + tax + service

    for item in self.items: 
        print(f'{item} ${[item]}')

    print(f'{"Total"} ${total:.2f}')

and using 'Cmder' from the website, I'm writing this and getting this error:

'>>>from bar_tab import tab

Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'tab' from 'bar_tab ' (C:\Users...\

I don't understand what I'm doing wrong. Just trying to import this class from module. Can someone please help?

spidermunky's avatar
asked 2019-02-18 01:36:32 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments