Skip to content

Commit 5c7e945

Browse files
authored
Add files via upload
0 parents  commit 5c7e945

21 files changed

+876
-0
lines changed

study1.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Kullanıcı Giriş örneği
2+
3+
print("""
4+
*******************************
5+
Kullanıcı Girişi Programı
6+
*******************************
7+
""")
8+
9+
username = "zehra"
10+
11+
parola = "1234"
12+
13+
hak = 3
14+
nameDogru = False
15+
16+
17+
for i in range(hak):
18+
if not nameDogru:
19+
name = input("Kullanici adınızı giriniz: ")
20+
pw = input("Parolanızı giriniz: ")
21+
if name == username:
22+
nameDogru = True
23+
if pw == parola:
24+
print("Giriş Başarılı!!")
25+
break
26+
27+
else:
28+
hak -= 1
29+
print("Parola Hatalı!!Kalan hakkınız:{}".format(hak))
30+
continue
31+
else:
32+
hak -= 1
33+
print("Kullanıcı adı hatalı!! Kalan hakkınız: {}".format(hak))
34+
35+
if hak == 0:
36+
print("Giriş Hakkınız Bitti...")
37+
break

study10.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Bir tane "Bilgisayar" sınıfı oluşturarak bu sınıfa metodlar ve özellikler
3+
ekleyin ve bu class'ı kullanmaya çalışın.
4+
"""
5+
import time
6+
7+
class Computer_class():
8+
def __init__(self,number_of_people,number_of_computers):
9+
self.number_of_people=number_of_people
10+
self.number_of_computers=number_of_computers
11+
def __str__(self):
12+
return "Number of People: {}\nNumber of computers".format(self.number_of_people,self.number_of_computers)
13+
14+
15+
def balance(self):
16+
17+
if (self.number_of_people<=self.number_of_computers):
18+
print("Computer are enough...")
19+
20+
elif (self.number_of_people > self.number_of_computers):
21+
22+
a =int(self.number_of_people)-int(self.number_of_computers)
23+
24+
self.number_of_computers += a
25+
print("Are held...")
26+
time.sleep(1)
27+
print("Updated issue: ",self.number_of_computers,"Added: ",a)
28+
29+
computer_class=Computer_class(110,90)
30+
print("""
31+
Computer Class Welcome
32+
33+
1.Computer Class information
34+
2.To balance
35+
36+
press 'q' to exit process
37+
""")
38+
while True:
39+
process =input("Make your choice..: ")
40+
if (process== 'q'):
41+
print("Transaction exited...")
42+
43+
elif (process == "1"):
44+
45+
print("Student: {}\nComputer: {}".format(computer_class.number_of_people,computer_class.number_of_computers))
46+
47+
elif(process=="2"):
48+
computer_class.balance()
49+
50+
else:
51+
print("The operation you want to perform could not be found....")
52+
break

study11.py

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
"""
2+
Bu projede ise 4 tane sınıfı oluşturun.
3+
Hayvan Sınıfı ------> Bütün hayvanların ortak özelliklerinin toplandığı sınıf
4+
olacak.
5+
Köpek Sınıfı ------> Bu sınıf, hayvan sınıfından miras alan bir sınıf olacak.
6+
Ayrıca bu sınıfa köpeklere ait ek özellikler ve metodlar ekleyin.
7+
Kuş Sınıfı ------> Bu sınıf, hayvan sınıfından miras alan bir sınıf olacak.
8+
Ayrıca bu sınıfa kuşlara ait ek özellikler ve metodlar ekleyin.
9+
At Sınıfı ------> Bu sınıf, hayvan sınıfından miras alan bir sınıf olacak.
10+
Ayrıca bu sınıfa atlara ait ek özellikler ve metodlar ekleyin.
11+
"""
12+
13+
import time
14+
15+
class Animals():
16+
17+
def __init__(self,name,types,colors,feet,habitat,act):
18+
19+
self.name=name
20+
self.types=types
21+
self.colors=colors
22+
self.feet=feet
23+
self.habitat=habitat
24+
self.act=act
25+
26+
def __str__(self):
27+
return "Name: {}\nTypes: {}\nColors: {}\nNumber of feet: {}\nHabitat: {}\nAct: {}".format(self.name,self.types,self.colors,self.feet,self.habitat,self.act)
28+
29+
30+
class Dogs(Animals):
31+
def __init__(self, name, types, colors, feet, habitat, act,nutrition):
32+
super().__init__(name, types, colors, feet, habitat, act)
33+
34+
35+
self.nutrition=nutrition
36+
37+
def __str__(self):
38+
return super().__str__() + "\nDiet: {}".format(self.nutrition)
39+
40+
41+
42+
class Birds(Animals):
43+
44+
def __init__(self, name, types, colors, feet, habitat, act,mouth_shape,movement_limbs):
45+
super().__init__(name, types, colors, feet, habitat, act)
46+
47+
self.mount_shape=mouth_shape
48+
self.movement_limbs=movement_limbs
49+
50+
def __str__(self):
51+
return super().__str__() +"\nMouth shape: {}\nMovement limbs: {}".format(self.mount_shape,self.movement_limbs)
52+
53+
class Horses(Animals):
54+
55+
def __init__(self, name, types, colors, feet, habitat, act,place_in_life):
56+
super().__init__(name, types, colors, feet, habitat, act)
57+
58+
self.place_in_life=place_in_life
59+
def __str__(self):
60+
return super().__str__() + "\nPlace in life: {}".format(self.place_in_life)
61+
62+
dog =Dogs("Shadow","Siberian Husky","White",4,"Pets","Active movement","Carnivorous")
63+
64+
bird=Birds("Blues","Canary","Yellow",2,"Pets","Active movement","Beak","Wings")
65+
66+
horse=Horses("No information","Yılkı Horses","Black",4,"Wild","Active movement","Plains")
67+
68+
print("""
69+
70+
Hello ,Welcome
71+
72+
Animal App
73+
74+
1)Information for dog
75+
76+
2)Information for bird
77+
78+
3)Information for horse
79+
80+
Select 'q' to exit the application...
81+
""")
82+
83+
while True:
84+
85+
process=input("Select the action: ")
86+
if (process == "q"):
87+
88+
print("Exiting the application...")
89+
time.sleep(1)
90+
break
91+
92+
elif (process == "1"):
93+
print("Loading information for Dog ...")
94+
time.sleep(1)
95+
print(dog)
96+
97+
98+
elif (process== "2"):
99+
print("Loading information for Bird...")
100+
time.sleep(1)
101+
print(bird)
102+
103+
elif (process == "3"):
104+
print("Loading information for Horse...")
105+
time.sleep(1)
106+
print(horse)
107+
else:
108+
print("""The operation you entered is incorrect...
109+
Change Your Transaction!""")

study12.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Elinizde stringlerin bulunduğu bir liste bulunduğunu düşünün.
3+
liste = ["345","sadas","324a","14","kemal"]
4+
Bu listenin içindeki stringlerden içinde sadece rakam bulunanları ekrana yazdırın.
5+
Bunu yaparken try,except bloklarını kullanmayı unutmayın.
6+
"""
7+
8+
9+
10+
liste = ["345","sadsf","14","Kemal","sdsf","22"]
11+
for i in liste:
12+
try:
13+
i=int(i)
14+
print(i, end=" ")
15+
except:
16+
pass

study13.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Bir sayının çift olup olmadığını sorgulayan bir fonksiyon yazın.
3+
Bu fonksiyon, eğer sayı çift ise return ile bu değeri dönsün.
4+
Ancak sayı tek sayı ise fonksiyon raise ile ValueError hatası
5+
fırlatsın. Daha sonra, içinde çift ve tek sayılar bulunduran bir
6+
liste tanımlayın ve liste üzerinde gezinerek ekrana sadece çift
7+
sayıları bastırın."""
8+
9+
def cift_mi(sayı):
10+
11+
if (sayı % 2==0):
12+
return sayı
13+
else:
14+
raise ValueError
15+
16+
liste = [34,2,1,3,33,100,61,1800]
17+
18+
for i in liste:
19+
try:
20+
print(cift_mi(i),end=" ")
21+
22+
except ValueError:
23+
pass

study14.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
""""futbolcular.txt" şeklinde bir dosya oluşturun ve içine Galatasaray,
2+
Fenerbahçe ve Beşiktaşta oynayan futbolcuları rastgele yerleştirin.
3+
Bu dosyadan herbir takımın futbolcularını ayırarak "gs.txt" , "fb.txt",
4+
"bjk.txt" şeklinde 3 farklı dosyaya yazın.
5+
6+
"futbolcular.txt" dosyasının başlangıç hali şu şekilde olsun.
7+
8+
Fernando Muslera,Galatasaray
9+
Atiba Hutchinson,Beşiktaş
10+
Simon Kjaer,Fenerbahçe
11+
//
12+
//
13+
//
14+
//
15+
//
16+
"""
17+
18+
with open("futbolcular.txt","r",encoding="utf-8") as file:
19+
20+
gs = list()
21+
bjk = list()
22+
fb = list()
23+
for i in file:
24+
i= i[:-1]
25+
satır_elemanları = i.split(",")
26+
if (satır_elemanları[1] == "Fenerbahçe"):
27+
fb.append(i + "\n")
28+
elif (satır_elemanları[1] == "Galatasaray"):
29+
gs.append(i+ "\n")
30+
31+
else:
32+
bjk.append(i + "\n")
33+
with open("gs.txt","w",encoding="utf-8") as file1:
34+
for i in gs:
35+
file1.write(i)
36+
37+
38+
39+
with open("fb.txt","w",encoding="utf-8") as file2:
40+
for i in fb:
41+
file2.write(i)
42+
with open("bjk.txt","w",encoding="utf-8") as file3:
43+
for i in bjk:
44+
file3.write(i)

study15.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Elinizde bir dikdörtgenin kenarlarını ifade eden sayı
3+
çiftlerinin bulunduğu bir liste olsun.
4+
5+
[(3,4),(10,3),(5,6),(1,9)]
6+
7+
Şimdi kenar uzunluklarına göre dikdörtgenin alanını
8+
hesaplayan bir fonksiyon yazın ve bu listenin her bir
9+
elemanına bu fonksiyonu uygulayarak ekrana şöyle bir
10+
liste yazdırın.
11+
12+
[12, 30, 30, 9]
13+
14+
Not: map() fonksiyonunu kullanmaya çalışın.
15+
"""
16+
17+
18+
19+
liste1=[(3,4),(10,3),(5,6),(1,9)]
20+
liste2=[]
21+
liste3=[]
22+
for i in liste1:
23+
for j,k in enumerate(i):
24+
if j %2==0:
25+
liste2.append(k)
26+
else:
27+
liste3.append(k)
28+
print(liste2,liste3)
29+
30+
print(list(map(lambda x,y: x*y,liste2,liste3)))

study16.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
Elinizden her bir elemanı 3'lü bir demet olan bir liste
3+
olsun.
4+
5+
[(3,4,5),(6,8,10),(3,10,7)]
6+
7+
Şimdi kenar uzunluklarına göre bu kenarların bir üçgen
8+
olup olmadığını dönen bir fonksiyon yazın ve sadece üçgen
9+
belirten kenarları bulunduran listeyi ekrana yazdırın.
10+
11+
[(3, 4, 5), (6, 8, 10)]
12+
13+
Not:filter() fonksiyonunu kullanmaya çalışın
14+
"""
15+
16+
17+
def ucgen_mi(h):
18+
19+
if (abs(h[0]+h[1])> h[2] and abs(h[0]+h[2])>h[1] and abs(h[1]+ h[2])>h[0]):
20+
return True
21+
else:
22+
return False
23+
s =[(3,4,5),(6,8,10),(3,10,7)]
24+
print(list(filter(ucgen_mi,s)))

0 commit comments

Comments
 (0)