If I enter any information other than "13245678" and "12345678", the application gives an error. Otherwise the app works exactly as I want it to.
The error I get is as follows:
Adınızı Giriniz: harun Hesap Numaranızı Giriniz: 545 Traceback (most recent call last):
File "c:\Users\LNV\Desktop\Python Çalışmalarım\Python_Temelleri\Fonksiyonlar\bankamatik.py", line 52, in bankamatik(ad, hesapNo)
File "c:\Users\LNV\Desktop\Python Çalışmalarım\Python_Temelleri\Fonksiyonlar\bankamatik.py", line 17, in bankamatik if (hesapNo == BankaHesaplari[hesapNo]["hesapNo"] and ad == BankaHesaplari[hesapNo]["ad"]): KeyError: '545'
BankaHesaplari = {
"13245678": {"ad": "Sadık Turan", "hesapNo": "13245678", "bakiye": 3000, "ekHesap": 2000},
"12345678": {"ad": "Ali Turan", "hesapNo": "12345678", "bakiye": 2000, "ekHesap": 1000},
}
def bankamatik(ad, hesapNo):
if hesapNo == BankaHesaplari[hesapNo]["hesapNo"] and ad == BankaHesaplari[hesapNo]["ad"]:
neKadar = float(input(f"Merhaba {hesapNo}'lu kullanıcı, {ad}. Ne kadar para çekmek istersiniz: "))
if neKadar <= BankaHesaplari[hesapNo]["bakiye"]:
cevap1 = input(
f"Bakiyeniz yeterli. {BankaHesaplari[hesapNo]['bakiye']} TL paranız bulunmaktadır. Evet / Hayır?: "
)
I deleted the rest as I thought it would be more descriptive.