随笔分类 - 青年小白学Python
摘要:1.基本语法[]创建 a=[10,20,'luis',frank'] a=[] 创建一个空的列表对象 2.list()创建 使用list()可以将任何可迭代的数据转化称列表。 a=list() 创建一个空的列表对象 a=list(range(10)) a [0,1,2,3,4,5,6,7,8,9]
阅读全文
摘要:1.将to be or not to be字符串倒序输出 a='to be or not to be' b=a[:: 1] print(b) 2.将sxtsxtsxtsxtsxt字符串所有的S输出 a='sxtsxtsxtsxtsxt' b=a[::3] print(b)
阅读全文
摘要:import turtle import math 定义多个点的坐标 x1,y1=100,100 x2,y2=100, 100 x3,y3= 100, 100 x4,y4= 100,100 绘制折线 turtle.penup() turtle.goto(x1,y1) turtle.pendown()
阅读全文
摘要:import turtle turtle.showturtle() 显示箭头,并绘制第一个300 300的矩形 turtle.goto(300,0) turtle.goto(300,300) turtle.goto(0,300) turtle.goto(0,0) turtle.penup() 绘制第
阅读全文
摘要:import turtle turtle.width(10) turtle.color("bolue") turtle.circle(50) turtle.color("black") turtle.penup() turtle.goto(120,0) turtle.pendown() turtle
阅读全文
摘要:imrort turtle 导入turtle模块 turtle.showturtle() 显示箭头 turtle.write("Frank") 写字符串 turtle.forward(300) 前进300像素 turtle.color("red") 画笔颜色给为红色 turtle.left(90)
阅读全文

浙公网安备 33010602011771号