From 3b9bc043430979f13345e0a79e63b1c5d4f99ffc Mon Sep 17 00:00:00 2001 From: jonnybravo Date: Thu, 11 May 2023 20:00:01 +0200 Subject: [PATCH] commit message from python script --- LohnRechner/data | Bin 16384 -> 16384 bytes LohnRechner/lohn_calc.py | 61 +++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/LohnRechner/data b/LohnRechner/data index 7f9693061020a8d30ef9ab02a8d38a4a6906e455..355676cd87cc2e4bad0664f2631edf905fa390c3 100644 GIT binary patch literal 16384 zcmeH}yGjE=7==e?8ygYy0W7V=U~3UU3~Y=R7S@rB7Ys>|j6y*00k(6~h_$7!l4r2= z9R!`r9~jUDErLY8g`KlAJHx+xd*fdd@U{ed6w1Aa&e;D?k(RX)_lo$Z7E zMej|%-&~kAjN_}H_zIuk6MT{qzz-=6@?pOG;QtZsv$2tPcvo%|I&b&N=3=4u z&1uJP?(A~kc^e=?8*(ozzE00bZa0SG_<0uX=z1Rwwb2>cm=Pv+1}VE_OC delta 100 zcmZo@U~Fh$T%aJt$N&LX_#w28!9>HT%{dAs?7R#H5Fr*IrLkF7<1zc>3;N~?vJg>* i+9?`6%wCCkQ@j~^nB7v7z_f2->gIUEg?t+wEEoaIyB0M7 diff --git a/LohnRechner/lohn_calc.py b/LohnRechner/lohn_calc.py index a9e8864..c965c29 100644 --- a/LohnRechner/lohn_calc.py +++ b/LohnRechner/lohn_calc.py @@ -2,35 +2,42 @@ import shelve, os -#spieler_endrunde = ['Heinz', 'Schrödinger', 'Bill'] -#speicher = shelve.open('meineDaten') -#speicher['imFinale'] = spieler_endrunde -#speicher.close() - -#mein_speicher = shelve.open('meineDaten') #magie -#print(mein_speicher['imFinale']) -#spieler = mein_speicher['imFinale'] -#for name in spieler: -# print(name) -#mein_speicher.close() - - class steuer_rechner: def __init__(self, lohn_eingabe = int) -> None: self.lohneingabe = lohn_eingabe self.data_datei = os.path.dirname(os.path.realpath(__file__)) + os.sep + "data" - print(self.data_datei) + self.month = ['Jan', 'Feb', 'Mae', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] if not os.path.exists(self.data_datei): - month = ['Jan', 'Feb', 'Mae'] - month_dict = dict.fromkeys(month, 0) + month_dict = dict.fromkeys(self.month, 0) with shelve.open(self.data_datei) as db: db['Lohn'] = month_dict with shelve.open(self.data_datei) as db: print(db['Lohn']) - + def modify_data (self, month = str, money = int): + #check value + yes_exist = False + for check_value in self.month: + if check_value == month: + yes_exist = True + if not yes_exist is True: + print("false value") + return False + + with shelve.open(self.data_datei, writeback=True) as db_data: + db_data['Lohn'][month] = money + + return True + + def sum_calc(self): + calc = 0 + with shelve.open(self.data_datei) as db: + for test in db['Lohn'].values(): + calc = calc + test + return calc + def prozent_rechner(self, prozent): prozent_wert = self.lohneingabe * (prozent / 100) @@ -44,9 +51,25 @@ class steuer_rechner: def lohn_steuer_klass2(self): pass + def main(self): - test = steuer_rechner.prozent_rechner(self, prozent=18.1) - print(test) + while True: + my_input = input("Wollen Sie Daten hinzufügen y|n:") + print(my_input) + if not my_input == 'n' and not my_input == 'y': + print("richtig") + elif my_input == 'y': + print("richtg eingabe y") + elif my_input == 'n': + print("raus") + break + + + #test = steuer_rechner.prozent_rechner(self, prozent=18.1) + #modify_data = steuer_rechner.modify_data(self, month="Oktoo", money=1231.12) + #sum_rechner = steuer_rechner.sum_calc(self) + #print("Summe im Jahr :"sum_rechner) + #print(modify_data) #print(self.lohneingabe)