注意標準庫的兩種匯入與使用方式,建議大家採用《庫名》.《函式名》的方式。
對前面的**進行優化,用for,while,if,def實現:畫五角星
畫同心圓
畫太陽花
畫五個五角星
importturtle
turtle.speed(10)
turtle.color(
'yellow')
turtle.bgcolor(
'red')
defmygoto(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
defdrawfive(r):
turtle.begin_fill()
for i in range(5):
turtle.forward(r)
turtle.right(144)
turtle.end_fill()#大星
mygoto(-300,150)
drawfive(100)#小星
畫◇花瓣的太陽花
條件 迴圈 函式定義 練習
注意標準庫的兩種匯入與使用方式,建議大家採用 庫名 函式名 的方式。對前面的 進行優化,用for,while,if,def實現 畫五角星 畫同心圓 畫太陽花 畫五個角星 import turtle 畫五角星 for i in range 5 turtle.forward 100 turtle.rig...
條件 迴圈 函式定義
1.用迴圈畫五角星 import turtle turtle.setup 600,400,0,0 turtle.color yellow turtle.bgcolor red turtle.fillcolor yellow turtle.up turtle.goto 250,75 turtle.do...
條件,迴圈,函式
1 單行注釋和多行注釋 單行注釋 多行注釋 2.python程式的執行原理 首先cup將python直譯器載入到記憶體中,然後python直譯器會讓cpu根據 語法規則解釋python程式中的 cpu最終執行翻譯後的 3.關閉所有開啟頁 右擊乙個頁的標題頭,選擇close all close oth...