xingtai -复习猜拳游戏

import random
"""
石头 1     布  2     剪刀3
赢:
电脑     我们      结果
1           2      -1
2           3      -1
3          1       2
输:
电脑     我们      结果
1          3       -2
2          1        1
3          2        1
平局:
电脑     我们      结果
1          1         0
2          2        0
3          3        0

"""

# 1.电脑产生一个随机整数 1-3
for a in range(99999999999999999999999999999999999):
    computer = random.randint(1,3)  # int
    # 2.我们出拳
    we = input("你在武汉出什么????") # str
    we = int(we)
    # 比较
    jieguo =   computer - we
    if jieguo==-1 or jieguo==2:
        print("武汉必胜")
    elif jieguo==-2 or jieguo==1:
        print("捐点物资吧!!!")
    elif  jieguo==0:
        print("加油,武汉!!")

    print(computer)
    print(we)


import random
# 产生随机0-1小数
a = random.random() # 数字
print(a)
# 产生随机整数  integer
b = random.randint(1,100)
print(b)
print(a+b)

import turtle
import random
# 变量
xxj=120
for d in range(300000):
    turtle.fd(100)
    turtle.rt(xxj)

turtle.done()


发布了305 篇原创文章 · 获赞 18 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/104174454
今日推荐