美文网首页
【课程系列知识点】turtle—画图系列

【课程系列知识点】turtle—画图系列

作者: 韩老司 | 来源:发表于2021-05-28 15:05 被阅读0次

turtle—太极阴阳鱼图

https://baike.baidu.com/item/%E9%98%B4%E9%98%B3%E9%B1%BC/6022217?fr=aladdin

image.png image.png image.png
image.png

思考如何绘制

image.png image.png image.png
import turtle

t = turtle.Pen()

widthall = 200
width = 20
num = widthall // 20 * 2 + 1

t.speed(10)

for r in range(num):
    t.penup()
    t.goto(-widthall, widthall - width * r)
    t.pendown()
    t.goto(widthall, widthall - width * r)

for c in range(num):
    t.penup()
    t.goto(-widthall + width * c, widthall)
    t.pendown()
    t.goto(-widthall + width * c, -widthall)

turtle.done()
蓝桥杯真题
1.1

2.10 数列特征
问题描述

给出n个数,找出这n个数的最大值,最小值,和。
输入格式

第一行为整数n,表示数的个数。

第二行有n个数,为给定的n个数,每个数的绝对值都小于10000。
输出格式
输出三行,每行一个整数。第一行表示这些数中的最大值,第二行表示这些数中的最小值,第三行表示这些数的和。
样例输入
5
1 3 -2 4 5
样例输出
5
-2
11
数据规模与约定
1 <= n <= 10000。

n = int(input())

arr = input().split()

print(max(int(arr[i]) for i in range(n))) # 最大值
print(min(int(arr[i]) for i in range(n))) # 最小值
print(sum(int(arr[i]) for i in range(n))) # 求和

1.2

对于长度为5位的一个01串,每一位都可能是0或1,一共有32种可能。它们的前几个是:

00000

00001

00010

00011

00100

请按从小到大的顺序输出这32种01串。
输入格式
本试题没有输入。
输出格式
输出32行,按从小到大的顺序每行一个长度为5的01串。
样例输出
00000
00001
00010
00011

相关文章

网友评论

      本文标题:【课程系列知识点】turtle—画图系列

      本文链接:https://www.haomeiwen.com/subject/owcksltx.html