stargradient.py

Created by cent20

Created on December 18, 2021

578 Bytes


# Auteur : Bastien S., elève de seconde
"""
Réalisé dans le cadre d'un devoir maison "Les mathématiques sont belles"
https://twitter.com/nsi_xyz/status/1380207106947739653
La version originale du script non optimisée est ici : 
https://my.numworks.com/python/bastien-lpa2/stargradient à tester avec 200
"""


from turtle import *

pensize(2)
speed(10)
color(42,42,42)
hideturtle()
penup()
goto(-100,42)
pendown()

def star(n):
  for i in range(1,n):
    forward(200*((90-i)/90))
    right(135)
    if i%8==0:
      color(42+4*i,42+4*i,42+5*i)

star(42)

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.