commit message from python script
This commit is contained in:
BIN
LohnRechner/data
BIN
LohnRechner/data
Binary file not shown.
@@ -2,34 +2,41 @@
|
|||||||
|
|
||||||
|
|
||||||
import shelve, os
|
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:
|
class steuer_rechner:
|
||||||
def __init__(self, lohn_eingabe = int) -> None:
|
def __init__(self, lohn_eingabe = int) -> None:
|
||||||
self.lohneingabe = lohn_eingabe
|
self.lohneingabe = lohn_eingabe
|
||||||
self.data_datei = os.path.dirname(os.path.realpath(__file__)) + os.sep + "data"
|
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):
|
if not os.path.exists(self.data_datei):
|
||||||
month = ['Jan', 'Feb', 'Mae']
|
month_dict = dict.fromkeys(self.month, 0)
|
||||||
month_dict = dict.fromkeys(month, 0)
|
|
||||||
with shelve.open(self.data_datei) as db:
|
with shelve.open(self.data_datei) as db:
|
||||||
db['Lohn'] = month_dict
|
db['Lohn'] = month_dict
|
||||||
|
|
||||||
with shelve.open(self.data_datei) as db:
|
with shelve.open(self.data_datei) as db:
|
||||||
print(db['Lohn'])
|
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):
|
def prozent_rechner(self, prozent):
|
||||||
@@ -44,9 +51,25 @@ class steuer_rechner:
|
|||||||
|
|
||||||
def lohn_steuer_klass2(self):
|
def lohn_steuer_klass2(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
test = steuer_rechner.prozent_rechner(self, prozent=18.1)
|
while True:
|
||||||
print(test)
|
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)
|
#print(self.lohneingabe)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user