e04.py

Created by ilyas-r

Created on August 07, 2023

361 Bytes

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


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.