Personal tools
You are here: o studio 110 2016-17 tmp Inf 11 doku doku s py s upload Blume.py

Blume.py

Blume.py — Python Source, 1Kb

File contents

# Python für Kids - 4. Auflage

# Autor: Gregor Lingl
# Datum 10. 8. 2009
# wabe.py - Kapitel 2: Aufgabe 10 

from turtle import *


reset()

farben=("yellow","green", "cyan","orange","red","brown","blue","black",)

def a(n,m,o):
  
  pensize(0)
  pencolor("white")
  forward(20)
  left(5)
  forward(20)
  left(5)
  forward(20)
  left(5)
  forward(20)
  left(5)
  forward(20)
  left(5)
  forward(20)
  left(5)
  pendown()
  for i in range(n):
    fillcolor(farben[o])
    pendown()

    begin_fill()
    forward(10)
    right(10)
    forward(10)
    right(10)
    forward(10)
    right(10)
    forward(10)
    right(10)
    forward(10)
    right(10)
    forward(10)
    right(10)
    end_fill()
    penup()
    forward(10)
    left(10)


def b(x):
    for i in range(x):
      n=i*10
      a(n)
      left(245)
      forward(25)

m=1
o=5
home()
pencolor("white")
setheading(90)
forward(50)
for i in range(100):
  p=1

  a(7,m,o)
  
  left(222*p)
  p=p+1
  if ((len(farben)-1)>m):
    m=m+1
  else:
    m=0
  if ((len(farben)-1)>o):
    o=o+1
  else:
    o=0

u(1)
Document Actions