duration=input("Enter day duration here:")
amount=input("Enter the amount here:")
def make_decision(duration,amount):
if (duration<=0 or amount <=0):
print "Invalid value"
elif (duration<30):
if (amount>=50):
corresponding_value = "Medium"
elif (amount<50):
corresponding_value = "Low"
elif (duration>=30):
if (amount>=50):
corresponding_value = "High"
elif (amount<50):
corresponding_value = "High"
return corresponding_value
make_decision(duration,amount)
我不明白为什么请帮助!当我运行这个,它只是在获得输入后结束。 我修了不算帐间隔,但还是一样的!为什么我的函数没有返回值?
也许你想'打印make_decision(持续时间,量)'? – k4yaman
'else'里面的'if'在两种情况下都有相同的结果,因此会显得多余。 (它的'elif'条件必然是真的,所以会比'else'更好。) – tripleee