The function price() doesn’t change its return value, even if i change the self.weigth attribute. What is wrong with the code?
OBS: I know I don’t need to use a class for this exercise, I just used it for practice reasons.
Create a program that reads the weight of a load in integers. If the weight is up to 10 kg, please inform
that the value will be R$50.00. Between 11 and 20 kg, inform that the value will be R$ 80. If it is greater than 20
Please inform that shipping is not accepted.
class Load:
def init(self, weigth=None):
self.weigth = weigth
def price(self):
if self.weigth > 10 & self.weigth < 21:
return 80
elif self.weigth <= 10:
return 50
else:
return 0
load1 = Load()
load1.weigth = 5
load1.weigth
load1.price()