-1
def which_prize():
return "Congratulations! You have won a [prize name]!"
if Points ==0 or Points ==50:
print("Congratulations! You have won a [wooden rabbit]!")
elif Points ==0 or Points ==150:
print("Congratulations! You have won a [no prize]!")
elif Points==151 or Points ==180:
print("Congratulations! You have won a [wafer-thin mint]!")
elif Points ==181 or Points ==200:
print("Congratulations! You have won a [penguin]!")
else:
print("Oh dear, no prize this time.")
输入到which_prize()
将是点数(整数)。函数which_prize()
应返回文本“恭喜!您赢得了[奖品名称]!”如果他们赢得了奖品并且文字“哦,亲爱的,这次没有奖品”,那么将包括奖品名称。如果没有奖品。像往常一样,测试你的功能来检查它是否正确执行。带分支的代码
IndentationError: unindent does not match any outer indentation level.
你怎么能指望任何这些语句后,在函数的第一行,你'return'运行? – khelwood