python第一周

Posted 阮满欢

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python第一周相关的知识,希望对你有一定的参考价值。

一、五角星的绘制

import turtle as t
t.penup()
t.fd(-150)
t.pendown()
t.fillcolor("red")
t.begin_fill()
t.pensize(3)
for i in range(5):
    t.fd(300)
    t.right(144)
t.end_fill()
t.done

 

 二、六角形的绘制

import turtle as t
t.left(90)
for i in range(3):
     t.fd(50)
     t.right(120)
     t.fd(100)
t.seth(30)
for i in range(3):
     t.fd(100)
     t.right(120)
     t.fd(50)

 

 三、叠加等边三角形绘制

import turtle as t
t.setup(650,350,-50,20)
for i in range(3):
    t.fd(50)
    t.right(120)
t.seth(60)
for i in range(3):
    t.fd(50)
    t.right(120)
    t.fd(50)

 

以上是关于python第一周的主要内容,如果未能解决你的问题,请参考以下文章

学习python的第一步,记住这些单词,一周就能上手敲代码

python第一周

第一周:Python学习笔记

python学习笔记(第一周):变量

Python 学习第一周

python 第一周(第一天) 我的python成长记 一个月搞定python数据挖掘!