import random |
player = int ( input ( "请输入您要出的 石头(1)/剪刀(2)/布(3):" )) |
computer = random.randint( 1 , 3 ) |
print ( "玩家选择的是 %d - 电脑出的是 %d" % (player, computer)) |
if ((player = = 1 and computer = = 2 ) |
or (player = = 2 and computer = = 3 ) |
or (player = = 3 and computer = = 1 )): |
print ( "你赢了!" ) |
elif player = = computer: |
print ( "平局" ) |
else : |
print ( "你输了!" ) |
中级程序员
by: 初学python学生 发表于:2020-05-06 21:04:34 顶(1) | 踩(2) 回复
666
回复评论