-3
你好我有一个Python代码,不断给我一个错误,有人可能会继续之前看它。这是我的python类来计算手机话费的金额。我现在有这个但它不返回价值类的Python代码不返回值
经济计划包括$ 30无限的语音和文字,1 GB数据为10美元,每GB超过6美元。
正常计划包括$ 30无限的语音和文字,5 GB数据为30美元,每GB超过4美元。
class cellphone:
cost = 30
due = 0
amountGB = 0
Total = 0
def econPlan (self, gB, gbOver):
self.cost = 30
self.gB = 1
self.gbOver = 6
self.due = 0
while amountGB >= self.gB:
int(amountGB - self.gB)* self.gbOver
return self.due
while cPlan == Econ and amountGB >= self.gB:
print ("$",self.due)
def normPlan (self, gB, gbOver):
self.cost = 30
self.gB = 5
self.gbOver = 4
while amountGB >= self.gB:
int(amountGB - self.gB)* self.gbOver
return self.due
while cPlan == Norm and amountGB >= self.gB:
print ("$",self.due)
print (" Which Plan do you have: econ or norm?")
print (" Econ is $30 unlimited voice and text, 1 GB data for $10, and $6 for every GB over.")
print (" Norm is $30 unlimited voice and text, 5 GB data for $30, and $4 for every GB over.")
econ = cellphone.econPlan
norm = cellphone.normPlan
cellphone.cPlan = input ("So which plan do you have? >>")
if cellphone.cPlan == econ:
print ("you have the Economy plan")
elif cellphone.cPlan == norm:
print ("you have the Normal plan")
cellphone.amountGB = input ("how many GB did you used >>")
if cellphone.cPlan == "Econ":
print (cellphone.due)
发布错误... –
什么是错误? –
“自我”在哪里? –