self python
class Person:
def __init__(mysillyobject, name, age):
mysillyobject.name = name
mysillyobject.age = age
def myfunc(abc):
print("Hello my name is " + abc.name)
p1 = Person("John", 36)
p1.myfunc()
self python
class Person:
def __init__(mysillyobject, name, age):
mysillyobject.name = name
mysillyobject.age = age
def myfunc(abc):
print("Hello my name is " + abc.name)
p1 = Person("John", 36)
p1.myfunc()
python self nedir
'''
Created on 14 Jan 2017
@author: Ibrahim Ozturk
@author: www.ozturkibrahim.com
'''
class Musteri(object):
"""Bir banka musterisinin hesabindaki tutari kontrol etme. Musteri sinifi
asagidaki ozelliklere sahiptir :
Ozellikler:
isim : Musteri ismini tutan string turunde parametre
bakiye : Musterinin hesabinda halihazirdaki bakiyeyi gosteren float tipinde parametre.
"""
def __init__(self, isim, bakiye=0.0):
"""Girilen isim ile ve baslangic bakiyesi olarak sifiri koyan musteriyi olusturur."""
self.isim = isim
self.bakiye = bakiye
def paraCek(self, tutar):
"""Hesaptan ilgili tutarin cekilmesinin ardindan yeni bakiyeyi doner."""
if tutar > self.bakiye:
raise RuntimeError('Bakiye yetersiz.')
self.bakiye -= tutar
self.bilgiGoster()
return self.bakiye
def paraYatir(self, tutar):
"""Hesaba ilgili tutarin yatirilmasinin ardindan yeni bakiyeyi doner.."""
self.bakiye += tutar
self.bilgiGoster()
return self.bakiye
def bilgiGoster(self):
"""Ilgili musterinin ismini ve hesap bakiyesini ekrana basar.."""
print(self.isim + " isimli musteriye ait bakiye >> " + str(self.bakiye) + " TL'dir.")
musteri1 = Musteri('Ibrahim Ozturk', 500.0)
musteri1.paraCek(100.0)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us