import random print("欢迎来玩石头剪刀布游戏") ''' 石头----1 剪刀----2 布------3 ''' computer = random.randint(1, 3) playter = int(input('请输入石头----1,剪刀----2,布------3:')) if (playter == 1 and computer ==2) or (playter == 2 and computer ==3) or (playter == 3 and computer ==1): result = '您赢了' elif playter == computer: result = '不分输赢' else: result = '计算机赢了' print(f"你的选择是:{playter}") print(f"计算机的选择是:{computer}") print(f"结果:{result}")
发一个石头、剪刀、布游戏的代码
于 2023-09-01 14:50:12 首次发布