Python学习——猜拳小游戏
import random
player = int(input(“请输入:剪刀 0,石头 1,布2”))
computer = random.randint(0,2)# print(“玩家输入的是%d,电脑输入的是%d” %(player,computer)) 用于测试
if (player == 0) and (computer == 0) or (player == 1) and (computer == 1) or (player == 2) and (computer == 2):
print(“平局,继续决战到天亮”)
elif (player == 0) and (computer == 1) or (player == 1) and (computer == 2) or (player == 2) and (computer == 1):
print (“输了,要加油”)
else:
print (“赢了,太厉害”)
原文地址:https://blog.csdn.net/Tony_long7483/article/details/143998010
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!