Bob - RGB IF ELIF ELSE

# 消灭病毒怎么算输赢
# 电脑问我们一下还有多少病毒
# 我们有没有碰到病毒
# str 和 int

# 判断
nom = int(input("你正在玩打病毒游戏,请问还有几个病毒?(不写单位)"))
hp = int(input("你正在玩打病毒游戏,你碰到病毒了吗,碰到是1,没有是0"))

# 判断符号: > < ==  != 不等于   >=  <=
if hp == 0:
    if nom == 0:
        print("你赢了!")
    elif nom < 0:
        print("你这个人有一点毒!")
    else:
        print("Hurry up")
else:
    print("你这个人太毒!")

import turtle
import random

turtle.shape("turtle")
turtle.speed(random.randint(1, 100))
turtle.pensize(5)
# 颜色是怎么来的吗 光照反射回来能看到的
# 彩虹  七种颜色   水汽折射  太阳光  《===》七种颜色
# 三原色: 红黄蓝(颜料)
# 三间色: 绿紫橙(颜料)
# 三基色: 红绿蓝(光)  red  green blue  rgb
# 三个0-1的数字,分别代表rgb的颜色深度
turtle.bgcolor("black")
# turtle.color(0.1, 0.9, 0.31415926 )
#turtle.color(255/255,215/255,0/255)
for h in range(100):
    x = random.randint(-350, 350)
    y = random.randint(-350, 350)
    r = random.randint(0, 255)
    g = random.randint(0, 255)
    b = random.randint(0, 255)
    # turtle.color(r / 255, g / 255, b / 255)
    turtle.color(h*2 / 255, (255-h*2) / 255, 0 / 255)
    # if color == 1:
    #     turtle.color("red")
    #     turtle.bgcolor("black")
    # else:
    #     turtle.color("yellow")
    #     turtle.bgcolor("black")
    turtle.up()
    turtle.goto(x,y)
    turtle.down()
    long = random.randint(1, 30)
    turtle.begin_fill()
    for s in range(5):
        turtle.forward(long)
        turtle.left(144)
    turtle.end_fill()
turtle.done()



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

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/104224049