repl.it
@potatosmurfer/

mønster innlevering

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import turtle

screen = turtle.Screen()
pen = turtle.Turtle()

screen.bgcolor('black')
def cafirkant (f1, f2, f3, f4): #lager mønstrene
	pen.fd(f4) #flytter vekk fra forige
	pen.pendown()
	for f1 in range (f2):
		pen.left(f3) 
		pen.fd(f4)
	pen.penup()
pen.penup()
pen.left(45)

#diversje variabler
x, c, d, e, i = 0, 0, 0, 0, 0 
pen.speed(0)
pen.color('red')
pen.width(0.35)

c, d, e = 91, 42, 100
for i in range (5): #kjører scriptet 
	cafirkant(x, d, c, e)

pen.penup()
pen.left(-90)
pen.fd(220)
pen.color('blue')

c, d, e = 89, 42, 100	
for i in range (8):
	cafirkant(x, d, c, e)

pen.penup()
pen.right(162)
pen.fd(200)
pen.pendown()
pen.color('green')

x, c, d, e = 0, 101, 26, 100
for i in range (16):
  cafirkant(x, d, c, e)

screen.bgcolor('black')
pen.hideturtle()
result
console
?