Q:

Why do I get AttributeError. Its not working

class Bil(object):
    def __init__(self, tankVol, aktVol=0):
        self.tankVolym = tankVol
        self.aktuellVolym = aktVol

    def tanka(self, liter=5):
        self.aktuellVolym = self.aktuellVolym + liter
        over = self.aktuellVolym - self.tankVolym
        if over > 0 :
            self.aktuellVolym = self.tankVolym
        else:
            over = 0
        return over

print(Bil.tanka(80))
print(Bil.aktuellVolym)

Why will it not work?
AttributeError:
    "int" object as no attribute "aktuellVolym"

A:

Bil is a class.  I think you want an instance of the class instead.
bil_instance = Bil(80)  # Create instance of Bil.
print(bil_instance.tanaka())
print(bil_instance.aktuellVolym)

In this case, you're getting an AttributeError because:
Bil.tanka(80)

passes 80 as the self argument to your tanka function.  On python2.x, you would have gotten a different error saying that tanka needs a Bil instance as the first argument.

