码迷,mamicode.com
首页 > 其他好文 > 详细

函数定义与使用,字符串类型

时间:2018-05-17 11:44:26      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:style   LLC   enc   ide   函数定义   tle   字符串类型   ima   range   

import turtle

turtle.setup  (600,400,0,0)

turtle.bgcolor(‘red‘)
turtle.pencolor(‘yellow‘)
turtle.fillcolor(‘yellow‘)


def mygoto(x,y):
    turtle.penup()
    turtle.goto(x,y)
    turtle.pendown()

def draw5jx(r):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(r)
        turtle.right(144)
    turtle.end_fill()


mygoto(-250,100)
draw5jx(100)

mygoto(-100,150)
draw5jx(40)

mygoto(-40,100)
draw5jx(40)

mygoto(-40,40)
draw5jx(40)

mygoto(-100,0)
draw5jx(40)

turtle.hideturtle()
turtle.done()


stunum =‘201709080033‘
print(‘年级;‘+stunum[0:4])
print(‘专业:‘+stunum[4:8])
print(‘班级:‘+stunum[9:11])
print(‘序号:‘+stunum[11])


idno =‘440000199804024147‘
print(‘省市区:‘+idno[0:6])
print(‘生日:‘+idno[6:14])
print(‘性别:‘+idno[16])

 

技术分享图片

技术分享图片

 

函数定义与使用,字符串类型

标签:style   LLC   enc   ide   函数定义   tle   字符串类型   ima   range   

原文地址:https://www.cnblogs.com/mintine/p/9048304.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!