I'm fairly new to python and I know I am doing it wrong but can't seem to find the way it has to be done.
I want the user to input twice which box he wants. I want to use the value of the boxes he chose and add them to each other, and then print the value, so 2x input box1 should give the value of 80.
Later on I want the possibility to use a lot more boxes.
class Boxes:
'boxes with assigned weight'
def __init__(self, boxnr, weight):
self.boxnr = boxnr
self.weight = weight
box1 = Boxes('box1', 40)
box2 = Boxes('box2', 70)
box3 = Boxes('box3', 110)
def tot_weight(self, weight):
if input in Boxes:
total += Boxes[weight.self]
return self.tot_weight
print ('which box?')
weight = input ()
print('what is your next box?')
weight = input ()
print (tot_weight.self.weight())