您現在的位置是:首頁 > 網頁遊戲首頁網頁遊戲
濟南少兒程式設計:Scratch程式設計和Python讓孩子做出不一樣的聖誕節
- 2022-01-07
python聖誕樹怎麼程式設計
聖誕節快樂
Merry Christmas
藉著聖誕節的吉利,訴說心中的惦記。
伴隨聖誕節的歡喜,奉送永恆的支援,
把最溫馨的祝願給您,
願這個冬天飽含暖意。
A Merry Christmas and a wonderful New Year。
聖誕快樂,新年好!
May you have the best Christmas ever。
願你度過最美好的聖誕節!
Thinking of you and wishing you a beautiful Christmas season。
美麗的聖誕節之際,謹致我的思念與祝福。
Here is wishing you all a Merry Christmas and a New Year bright with joy and success。
祝聖誕快樂,新年充滿幸福和成功。
Wishing you and your family a very merry Christmas。
祝福您及您的家人聖誕快樂。
Wishing you a song in your heart at Christmas and blessings all year long。
聖誕之際,祝你心中有首快樂的歌,新年快樂!
聖誕節到了!
用程式設計的方式
Scratch程式設計動畫與Python畫聖誕樹吧
Scratch程式設計動畫送上聖誕祝福
部分角色程式碼
Python畫聖誕樹送上祝福
與Scratch相比,Python屬高階語言。
1、入門聖誕樹
是不是感覺Python太簡單LOW了?
程式碼如下:
height = 5
stars = 1
for i in range(height):
print((‘ ’ * (height - i)) + (‘*’ * stars))
stars += 2
print((‘ ’ * height) + ‘ |’)
2、進階聖誕樹
額,漂亮了許多。
部分程式碼如下:
import turtle
screen = turtle。Screen()
screen。setup(800,600)
circle = turtle。Turtle()
circle。shape(‘circle’)
circle。color(‘red’)
circle。speed(‘fastest’)
circle。up()
square = turtle。Turtle()
square。shape(‘square’)
square。color(‘green’)
square。speed(‘fastest’)
square。up()
circle。goto(0,280)
circle。stamp()
k = 0
for i in range(1, 17):
y = 30*i
for j in range(i-k):
……
3、高階聖誕樹
哇,好漂亮喔!
部分程式碼如下:
from turtle import *
import random
import time
n = 80。0
speed(“fastest”)
screensize(bg=‘seashell’)
left(90)
forward(3*n)
color(“orange”, “yellow”)
begin_fill()
left(126)
for i in range(5):
forward(n/5)
right(144)
forward(n/5)
left(72)