目录
-
1、示例一
-
2、示例二
-
3、示例三
1、示例一
脚本:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 公众号:Python大本营
height = 5
stars = 1
for i in range(height):
print((' ' * (height - i)) + ('*' * stars))
stars += 2
print((' ' * height) + '|')
运行效果:
2、示例二
脚本:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 公众号:Python大本营
import turtle
import time
screen = turtle.Screen()
screen.setup(375, 700)
circle = turtle.Turtle()
circle.shape('circle')
circle.color('red')
circle.speed('fastest')
circle.up()
square