码迷,mamicode.com
首页 > 编程语言 > 详细

Python基础

时间:2018-03-14 20:05:01      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:输入输出   pos   while   post   png   inf   end   开发环境   nbsp   

Pycharm开发环境设置与熟悉。

 

练习基本输入输出:

print(‘你好,{}.‘.format(name))

uprint(sys.argv)

 

库的使用方法:

import ...

from ... import ...

 

条件语句:

    if (abs(pos()))<1:

        break

 

循环语句:

for i in range(5):

while True:

 

函数定义:

def mygoto(x,y):

def drawjx(r):

 

综合练习:画一面五星红旗,将代码与运行截图发布博客交作业。

from turtle import *

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

setup(600,400,0,0)
color(yellow)
bgcolor(red)
fillcolor(yellow)

mygoto(-250,75)
begin_fill()
for i in range(5):
    forward(100)
    right(144)
end_fill()

mygoto(-100,150)
begin_fill()
for i in range(5):
    forward(50)
    right(144)
end_fill()

mygoto(-50,100)
begin_fill()
for i in range(5):
    forward(50)
    right(144)
end_fill()

mygoto(-50,50)
begin_fill()
for i in range(5):
    forward(50)
    right(144)
end_fill()

mygoto(-100,0)
begin_fill()
for i in range(5):
    forward(50)
    right(144)
end_fill()

done()

 

  技术分享图片

Python基础

标签:输入输出   pos   while   post   png   inf   end   开发环境   nbsp   

原文地址:https://www.cnblogs.com/wha000/p/8569673.html

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