for 循环 猜数字 绘图2 皮卡丘

#100以内既是5的倍数又是2的倍数的和
count = 0
for a in range(1001):
    if a % 5 == 0 and a % 2 ==0:
        count = count + a
print(count)

"""
猜数字游戏
1.100以内(包括100)
2.最多比赛三次
3.谁先胜利两次就输出**胜利 不在进行第三次比赛
4.若三次都比完没人胜利出局 那就是平局
5.谁的数字谁就赢
count1 = 0  # 记录甲获胜的次数
count2 = 0
for a in range(3):
    number1 = int(input('输入甲要猜的数字'))
    number2 = int(input('输入乙要猜的数字'))
    if number1>number2:
        count1=count1+1
    elif number1<number2:
        count2=count2+1
    if count1==2:
        break
    elif  count2==2:
        break
if count1>count2:
    print('甲获胜')
elif count1<count2:
    print('乙获胜')
else:
    print('平局')


"""

from random import randint
for x in range(3):
    user_name = int(input('请输入0-100以内任意一个数字:'))
    com_num = randint(0,101)
    if user_name>com_num:
        print('恭喜你赢了,电脑给出的数字是:',com_num)
    elif user_name == com_num:
        print('平局')
    else:
        print('电脑胜出电脑给出的数字是:',com_num)

import turtle

pen = turtle.Pen()
for x in range(100):
    pen.speed(20)
    pen.circle(50)
    pen.left(100)
    pen.color('red')
turtle.done()

 

import turtle

#画鼻子
def drawNose():
    turtle.penup()
    turtle.seth(90)
    turtle.fd(100)
    turtle.pendown()
    turtle.begin_fill()
    turtle.fillcolor('black')
    turtle.seth(45)
    turtle.fd(25)
    turtle.seth(135)
    turtle.circle(25,95)
    turtle.seth(315)
    turtle.fd(25)
    turtle.end_fill()

#画眼睛
def drawEyes(seth,fd,r):
    turtle.penup()
    turtle.seth(seth)
    turtle.fd(fd)
    turtle.pendown()
    turtle.begin_fill()
    turtle.fillcolor('black')
    turtle.circle(50)
    turtle.end_fill()
    turtle.penup()
    turtle.circle(50,r)
    turtle.pendown()
    turtle.begin_fill()
    turtle.fillcolor('white')
    turtle.circle(20)
    turtle.end_fill()

#画脸
def drawFace(seth,fd):
    turtle.penup()
    turtle.seth(seth)
    turtle.fd(fd)
    turtle.pendown()
    turtle.begin_fill()
    turtle.fillcolor('red')
    turtle.circle(70)
    turtle.end_fill()

#画嘴巴
def drawLip():
    turtle.penup()
    turtle.seth(135)
    turtle.fd(250)
    turtle.pendown()
    turtle.seth(-300)
    turtle.circle(30,-65)
    turtle.begin_fill()
    turtle.fillcolor('Firebrick')
    turtle.seth(165)
    turtle.fd(140)
    turtle.seth(195)
    turtle.fd(140)
    turtle.seth(-360)
    turtle.circle(30,-65)
    turtle.penup()
    turtle.seth(-60)
    turtle.circle(30,65)
    turtle.pendown()
    turtle.seth(-70)
    turtle.fd(240)
    turtle.circle(55,140)
    turtle.seth(70)
    turtle.fd(240)
    turtle.end_fill()
    turtle.seth(-110)
    turtle.fd(80)
    turtle.begin_fill()
    turtle.fillcolor('Firebrick')
    turtle.seth(120)
    turtle.circle(120,123)
    turtle.seth(-70)
    turtle.fd(165)
    turtle.circle(55,140)
    turtle.seth(72)
    turtle.fd(165)
    turtle.end_fill()

def main():
    turtle.pensize(4)
    turtle.hideturtle()
    turtle.setup(1000,600)
    turtle.speed(10)
    turtle.screensize(bg='yellow')
    drawNose()
    drawEyes(160,250,60)
    drawEyes(-9.5,530,230)
    drawFace(195,600)
    drawFace(-11,720)
    drawLip()
    turtle.done()

if __name__ == '__main__':
    main()

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值