Python基础综合练习

import  turtle

turtle.screensize(bg='red')
turtle.color('yellow')

def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()

mygoto(-250, 125)

turtle.begin_fill()
for i in range(5):
    turtle.forward(125)
    turtle.right(144)
turtle.end_fill()

mygoto(-105, 165)
turtle.left(40)

turtle.begin_fill()
for i in range(5):
    turtle.forward(35)
    turtle.right(144)
turtle.end_fill()

mygoto(-30, 135)
turtle.right(10)

turtle.begin_fill()
for i in range(5):
    turtle.right(144)
    turtle.forward(35)
turtle.end_fill()

mygoto(-40, 75)
turtle.left(40)

turtle.begin_fill()
for i in range(5):
    turtle.right(144)
    turtle.forward(35)
turtle.end_fill()

mygoto(-75, 20)
turtle.right(20)

turtle.begin_fill()
for i in range(5):
    turtle.right(144)
    turtle.forward(35)
turtle.end_fill()

turtle.done()

运行截图:

字符串练习:

http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html

取得校园新闻的编号

str = 'http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'
print(str[-14:-5])

 

 

https://docs.python.org/3/library/turtle.html

产生python文档的网址

addr1 = 'https://docs.python.org/3.6/library/'
addr2 = '.html'
addr = addr1 + 'turtle' + addr2
print(addr)

 

 

http://news.gzcc.cn/html/xiaoyuanxinwen/4.html

产生校园新闻的一系列新闻页网址

 

for i in range(2,229):
    print('http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html'.format(i))

 

转载于:https://www.cnblogs.com/129lai/p/8599644.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值