Fejezet 4, 5

This commit is contained in:
2021-12-07 11:16:57 +01:00
parent b234874262
commit b7f1716b79
6 changed files with 85 additions and 0 deletions

29
fejezet 4/rajzolás.py Normal file
View File

@@ -0,0 +1,29 @@
import turtle
a = turtle.Screen()
a.bgcolor('green')
a.title('Negyzet')
teknos = turtle.Turtle()
teknos.shape('turtle')
teknos.speed(100)
teknos.color('black')
def negyzet(t, n):
for i in range(4):
t.forward(n)
t.left(90)
n = 20
x = 0
y = 0
for i in range(5):
negyzet(teknos, n)
n += 20
x += -10
y += -10
teknos.penup()
teknos.goto(x, y)
teknos.pendown()
a.mainloop()

21
fejezet 4/rajzolás2.py Normal file
View File

@@ -0,0 +1,21 @@
import turtle
def negyzet(t):
for i in range(4):
t.forward(100)
t.left(90)
ablak = turtle.Screen()
ablak.title("Gyönyörű minta")
ablak.bgcolor("green")
teknos = turtle.Turtle()
teknos.color("blue")
teknos.pensize(3)
teknos.speed(10)
for i in range(20):
negyzet(teknos)
teknos.left(18)
ablak.mainloop()

0
fejezet 4/rajzolás3.py Normal file
View File

6
fejezet 5/okosságok.py Normal file
View File

@@ -0,0 +1,6 @@
napok = ["Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat", "Vasárnap"]
def nap(i):
return napok[i]
print(nap(3))

17
fejezet 5/okosságok2.py Normal file
View File

@@ -0,0 +1,17 @@
napok = ["Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat", "Vasárnap"]
def nap(indulas, ejszakak):
print(napok[indulas])
ottalvas = indulas + ejszakak + 1
akt_nap = indulas
for i in range(ejszakak):
if(akt_nap == 7):
akt_nap = 0
else:
akt_nap += 1
print(napok[akt_nap])
nap(0, 137)

12
fejezet 5/okosságok3.py Normal file
View File

@@ -0,0 +1,12 @@
pontszam = int(input())
if(pontszam < 60):
print("elegtelen")
elif(pontszam < 70):
print("elegseges")
elif(pontszam < 80):
print("kozepes")
elif(pontszam < 90):
print("jo")
else:
print("jeles")