我用Scratch和Python编程祝福送给您Merry Christmas!

网友投稿 2019-12-24 11:01

圣诞节快乐

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.
  圣诞之际,祝你心中有首快乐的歌,新年快乐!

https://cdn.china-scratch.com/timg/191226/11013W332-0.jpg

圣诞节到了!

用编程的方式

Scratch编程动画与Python画圣诞树吧

Scratch编程动画送上圣诞祝福

部分角色代码

https://cdn.china-scratch.com/timg/191226/110140F13-1.jpg

https://cdn.china-scratch.com/timg/191226/1101415357-2.jpg

Python画圣诞树送上祝福

https://cdn.china-scratch.com/timg/191226/1101426412-3.jpg

与Scratch相比,Python属高级语言。

1、入门圣诞树

https://cdn.china-scratch.com/timg/191226/1101431637-4.jpg

是不是感觉Python太简单LOW了?

代码如下:

height = 5

stars = 1

for i in range(height):

    print((' ' * (height - i)) + ('*' * stars))

    stars += 2

print((' ' * height) + ' |')

2、进阶圣诞树

https://cdn.china-scratch.com/timg/191226/11014CD5-5.jpg

额,漂亮了许多。

部分代码如下:

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、高级圣诞树

https://cdn.china-scratch.com/timg/191226/1101506252-6.jpg

哇,好漂亮喔!

部分代码如下:

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)

声明:本文章由网友投稿作为教育分享用途,如有侵权原作者可通过邮件及时和我们联系删除:freemanzk@qq.com