gpt4 book ai didi

python - 为什么我的 python if 语句不起作用?

转载 作者:太空宇宙 更新时间:2023-11-04 09:04:56 27 4
gpt4 key购买 nike

<分区>

我希望有人能帮助我。当我运行以下函数时,无论输入什么,都会打印规则。我看不出我做错了什么。

def check_rules():
while True:
request = input("\nWould you like to know the rules? (y/n) ")
if request == "y" or "Y":
print("""
1. Each player takes it in turn to roll a dice.
2. The player then turns over a card with the same
number as the number rolled to see how many ladybirds
there are (0-3).
3. The player keeps the card.
4. If a player rolls a number that is not on an unclaimed
card, play continues to the next player.
5. Play continues until there are no more cards.
6. The player with the most number of ladybirds wins.""")
break
elif request == "n" or "N":
break
else:
print("\nI'm sorry, I didn't understand that.")

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com