diff --git a/.gitignore b/.gitignore index cb952ab..eef457b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ __pycache__/main.cpython-312.pyc __pycache__/MainTracker.cpython-312.pyc build dist -start+tracker.spec +main.spec ideas.txt \ No newline at end of file diff --git a/calculator.log b/calculator.log new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index 16e4def..4fe1af0 100644 --- a/main.py +++ b/main.py @@ -10,14 +10,14 @@ def transaction(): reason = input("Choose a reason on why you made the transaction (All in one line): ") - heavyness = input("How much did you spend/got? (no money symbol): ") + value = input("How much did you spend/got? (no money symbol): ") - print(f"Are these statements correct? (Y/n) {transaction_type}, {date}, {reason}, {heavyness}") + print(f"Are these statements correct? (Y/n) {transaction_type}, {date}, {reason}, {value}") final_answer = input() if final_answer == "Y": print("\nCongrats, you've made a change!") - writing(transaction_type, date, reason, heavyness) + writing(transaction_type, date, reason, value) time.sleep(5) start() if final_answer == "n": @@ -26,13 +26,35 @@ def transaction(): transaction() return -def writing(transaction_type, date, reason, heavyness): +def writing(transaction_type, date, reason, value): file = open("tracker.log", "a") file.write(f"Date: {date}\n") file.write(f"Reason: {reason}\n") - file.write(f"How much spent/got: {transaction_type}{heavyness}\n\n") + file.write(f"How much spent/got: {transaction_type}{value}\n\n") return +def converter(): + os.system("cls") + print( + """How do you wanna convert? + Select one of these two options: + + - Convert dollars to euros (D) + - Convert euros to dollars (E)\n""") + entry_Q = input("Choose your operation: ") + value = int(input("How much of this currency do you wanna convert? ")) + if entry_Q == "D": + final_value = value * 0.895404 + print(f"Your outcome from ${value} is {final_value}€.") + if entry_Q == "E": + final_value = value * 1.116814 + print(f"Your outcome from {value}€ is {final_value}$.") + back = input("\nDo you wish to continue? (Y,n) ") + if back == "Y": + converter() + if back == "n": + start() + def start(): os.system("cls") print( @@ -40,10 +62,13 @@ def start(): Select one of these three options: - Add a new entry (A) + - Convert currency (C) - Close the program (E)\n""") entry_Q = input("Choose your operation: ") if entry_Q == "A": transaction() + if entry_Q == "C": + converter() if entry_Q == "E": os.abort()