Python 名称';Y';没有定义
因此,我一直在尝试运行以下代码:Python 名称';Y';没有定义,python,python-3.x,Python,Python 3.x,因此,我一直在尝试运行以下代码: def conference_call_discount(distance, basic_charge): if(distance >= 50): con_calc = basic_charge * 0.5 return con_calc elif(distance < 50): con_calc = 0 return con_calc con_call = str(input("Is it a conference
def conference_call_discount(distance, basic_charge):
if(distance >= 50):
con_calc = basic_charge * 0.5
return con_calc
elif(distance < 50):
con_calc = 0
return con_calc
con_call = str(input("Is it a conference call? "))
from call_charge_functions import conference_call_discount
conference = conference_call_discount(dist, starting_cost)
if con_call == y:
print("your conference call discount is", conference)
else:
conference = 0
def电话会议折扣(距离、基本费用):
如果(距离>=50):
con_calc=基本费用*0.5
返回CONU计算
elif(距离<50):
con_计算=0
返回CONU计算
con_call=str(输入(“这是电话会议吗?”)
从呼叫\费用\功能导入会议\呼叫\折扣
会议=电话会议折扣(距离、起始成本)
如果con_call==y:
打印(“您的电话会议折扣为”,电话会议)
其他:
会议=0
然而,我不断地得到这个错误:
名称错误:未定义名称“y”
如果:
if con_call == y:
您没有设置y的值
在比较y变量之前,您应该为它设置一个值。您没有定义
y
,因此您会得到错误。顺便说一句,您的识别是错误的。如果con_call==y:
您的意思是键入“y”
?好了,现在可以了,谢谢您的留言: