Created
December 20, 2021 19:51
-
-
Save sonerb/ec66d2eac615b1f7a355698f385fc23e to your computer and use it in GitHub Desktop.
donanimhaber for layk4t
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
hesaplar = [ | |
{ | |
"ad": "mehmet a", | |
"hesapNo": "8946534", | |
"bakiye": 2000, | |
"ekHesap": 1000 | |
}, | |
{ | |
"ad": "ali b", | |
"hesapNo": "8946534", | |
"bakiye": 2000, | |
"ekHesap": 1000 | |
} | |
] | |
def HesapBul(ad): | |
for idx, elem in enumerate(hesaplar): | |
if elem['ad'] == ad: | |
return idx | |
return -1 | |
def paraCek(hesapId, miktar): | |
print(f"merhaba {hesaplar[hesapId]['ad']} ") | |
if hesaplar[hesapId]["bakiye"] >= miktar: | |
hesaplar[hesapId]["bakiye"] -= miktar | |
print("paranızı alabilirsiniz") | |
BakiyeSorgulama(hesapId) | |
else: | |
toplam = hesaplar[hesapId]["bakiye"] + hesaplar[hesapId]["ekHesap"] | |
if toplam >= miktar: | |
ekHesapKulanımı = input("ek hesap kullanılsınmı (e/h) ") | |
if ekHesapKulanımı == "e": | |
ekHesapKullanılacakMiktar = miktar - hesaplar[hesapId]["bakiye"] | |
hesaplar[hesapId]["bakiye"] = 0 | |
hesaplar[hesapId]["ekHesap"] -= ekHesapKullanılacakMiktar | |
print("paranızı alabilirsiniz") | |
BakiyeSorgulama(hesap) | |
else: | |
print( | |
f" {hesaplar[hesapId]['hesapNo']} nolu hesabınızda {hesaplar[hesapId]['bakiye']} bulunmaktadır.") | |
else: | |
print( | |
"üzgünüz bakiyeniz yetmemmektedir lütven en kısa sürüde yükleme yapınız") | |
BakiyeSorgulama(hesapId) | |
def BakiyeSorgulama(hesapId): | |
print(f" {hesaplar[hesapId]['hesapNo']} nolu hesabınızda {hesaplar[hesapId]['bakiye']} tl bulunmaktadır. ek hesap limitiniz ise {hesaplar[hesapId]['ekHesap']} tl bulunmaktadır ") | |
def ParaYatır(hesapId, miktar): | |
hesaplar[hesapId]["bakiye"] += miktar | |
print("paranız yatırılılmıştır") | |
BakiyeSorgulama(hesapId) | |
hesapId = -1 | |
while hesapId < 0: | |
ad = input("hesap adı: ") | |
hesapId = HesapBul(ad) | |
if hesapId == -1: | |
print("Hesap bulunamadı!") | |
karar = int(input("para çekmek için 1 yatırmak içinse 2 yazınız: ")) | |
if karar == 1: | |
miktar = int(input("miktar: ")) | |
paraCek(hesapId, miktar) | |
if karar == 2: | |
miktar1 = int(input("miktar: ")) | |
ParaYatır(hesapId, miktar1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment