speedway.py

Created by ews31415

Created on December 14, 2021

621 Bytes

Use the Turtle module to draw a simple race track


# 2021-12-12 ews
from math import *
from turtle import *

# functions
def horiz(n):
  color(0,64,0)
  forward(n)

def vert(n):
  color(255,128,0)
  forward(n)
  
def rturn(n):
  color(128,64,0)
  for i in range(9):
    right(10)
    forward(n)


def lturn(n):
  color(128,64,0)
  for i in range(9):
    left(10)
    forward(n)

# track
pensize(3)
horiz(35)
lturn(5)
vert(20)
lturn(5)
horiz(70)
lturn(5)
vert(25)
rturn(5)
horiz(20)
lturn(3)
vert(25)
lturn(3)
horiz(50)
lturn(3)
vert(20)
rturn(5)
color(0,64,0)
goto(0,0)

# text
penup()
right(90)
forward(50)
right(90)
forward(25)
write("Numworks Speedway")