Created
December 7, 2019 11:20
-
-
Save gurayops/6493a6d616a103155e5baf57b96ec343 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Koltuk: | |
size = '50x50' | |
class Araba: | |
depo = 100 # degisken -> property | |
carType = '4x4' | |
seats = [Koltuk() for i in range(5)] | |
def __init__(self, color): | |
self.color = color | |
# fonksiyon -> method | |
def depoBosMu(self): | |
print(self.color) | |
if self.depo == 0: | |
return True | |
else: | |
return False | |
def depoyuDoldur(self): | |
maliyet = 100 - self.depo | |
self.depo = 100 | |
return maliyet | |
def depodanEksilt(self, miktar): | |
self.depo = self.depo - miktar | |
car1 = Araba('mavi') | |
car1.depodanEksilt(10) | |
""" | |
car2 = Araba() | |
car1.depo = 0 | |
print(car1.depoBosMu()) | |
car1.depo = 80 | |
ucret = car2.depoyuDoldur() | |
print(ucret) | |
print(car1.depo) | |
print(car2.depo) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment