soleil.py

Created by cent20

Created on August 15, 2023

394 Bytes

📙 Découvrir la NumWorks p.51
Représentation d’un soleil rayonnant en Python. Développé par Ilyas R. à l’occasion du DM E04.0 “Le Python et la Tortue” édition 2022-2023. #nsi_xyz


# Découvrir la NumWorks p.51
from turtle import goto,hideturtle,pos,pencolor,forward,right
from kandinsky import fill_rect
fill_rect(0,0,320,222,"black")
a,b,d=0,0,55
goto(0,d)
hideturtle()
while a != 210:
    for i in range(a):
        d = (abs(pos()[0])**2+abs(pos()[1])**2)**0.5
        pencolor(255,round(((d+30)/140)*255),0)
        forward(1)
    right(b)
    a,b = a+1,b+1

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.