与电脑猜拳

 1 player = int(input("请输入您要出的拳:石头(1)/剪刀(2)/布(3):"))
 2 computer = 1
 3 print("玩家选择的是%d-电脑选择的是%d" % (player, computer))
 4 if (player == 1 and computer == 2) or (player == 2 and computer == 3) or (
 5         player == 3 and computer == 1):
 6     print("电脑弱爆了!")
 7 elif computer == player:
 8     print("心有灵犀!")
 9 else:
10     print("电脑太厉害了!")

 

上一篇:CF1067D Computer Game


下一篇:Java单体应用 - 架构模式 - 03.设计模式-25.访问者模式