fejezet 5

This commit is contained in:
2021-12-07 14:05:50 +01:00
parent 95f49e0075
commit 2d855649f6
3 changed files with 114 additions and 0 deletions

34
fejezet 5/5.14.7.py Normal file
View File

@@ -0,0 +1,34 @@
import turtle
def oszlopok(t, magassag):
t.begin_fill()
t.left(90)
t.forward(magassag)
t.write(" "+ str(magassag))
t.right(90)
t.forward(40)
t.right(90)
t.forward(magassag)
t.left(90)
t.penup()
t.end_fill()
t.forward(10)
t.pendown()
a = turtle.Screen()
a.bgcolor("lightblue")
Eszti = turtle.Turtle()
Eszti.speed(100)
Eszti.color("blue", "red")
xs = [48,117,200,240,160,260,220]
for S in xs:
oszlopok(Eszti, S)
a.mainloop()

40
fejezet 5/5.14.8.py Normal file
View File

@@ -0,0 +1,40 @@
import turtle
def oszlopok(t, magassag):
if (magassag<100):
t.color("green")
elif(magassag<200):
t.color("yellow")
else:
t.color("red")
t.begin_fill()
t.left(90)
t.forward(magassag)
t.write(" "+ str(magassag))
t.right(90)
t.forward(40)
t.right(90)
t.forward(magassag)
t.left(90)
t.penup()
t.end_fill()
t.forward(10)
t.pendown()
a = turtle.Screen()
a.bgcolor("lightblue")
Eszti = turtle.Turtle()
Eszti.speed(100)
Eszti.color("blue", "red")
xs = [48,117,200,240,160,260,220]
for S in xs:
oszlopok(Eszti, S)
a.mainloop()

40
fejezet 5/5.14.9.py Normal file
View File

@@ -0,0 +1,40 @@
import turtle
def oszlopok(t, magassag):
if (magassag<100):
t.color("green")
elif(magassag<200):
t.color("yellow")
else:
t.color("red")
t.begin_fill()
t.left(90)
t.forward(magassag)
t.write(" "+ str(magassag))
t.right(90)
t.forward(40)
t.right(90)
t.forward(magassag)
t.left(90)
t.penup()
t.end_fill()
t.forward(10)
t.pendown()
a = turtle.Screen()
a.bgcolor("lightblue")
Eszti = turtle.Turtle()
Eszti.speed(100)
Eszti.color("blue", "red")
xs = [48,-117,200,-240,-160,260,220]
for S in xs:
oszlopok(Eszti, S)
a.mainloop()