Skip to content

Commit

Permalink
added writing to file
Browse files Browse the repository at this point in the history
  • Loading branch information
m9henri committed Sep 26, 2024
1 parent 148c928 commit b846732
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
__pycache__/main.cpython-312.pyc
__pycache__/MainTracker.cpython-312.pyc
build
dist
start+tracker.spec
ideas.txt
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "start+tracker.py",
"program": "main.py",
"console": "externalTerminal"
}
]
Expand Down
4 changes: 2 additions & 2 deletions ideas.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open:
main tracker (transaction type, date, reason, how much)
calculating from the tracker file
tracker.log
converter

done:
tracker.log
main tracker (transaction type, date, reason, how much)
8 changes: 8 additions & 0 deletions start+tracker.py → main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def transaction():
final_answer = input()
if final_answer == "Y":
print("\nCongrats, you've made a change!")
writing(transaction_type, date, reason, heavyness)
time.sleep(5)
start()
if final_answer == "n":
Expand All @@ -25,6 +26,13 @@ def transaction():
transaction()
return

def writing(transaction_type, date, reason, heavyness):
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")
return

def start():
os.system("cls")
print(
Expand Down

0 comments on commit b846732

Please sign in to comment.