Skip to content
← Back to Community
salary calculator
Profile icon
wzh14727

to calculate your salary
I am confused that how to save the py file???

Voters
Profile icon
wzh14727
Comments
hotnewtop
Profile icon
DanielObrian

Hi, I very rarely use loans, mostly it happens because of a strong need and it's good that now there are companies where you can apply and within a few hours you will already receive money, I turn to Alleviate Financial Reviews

Profile icon
EgorKrutilin

I always count my salary and try to count money so as not to spend on unnecessary things and there is enough money, but from time to time unforeseen expenses still arise for which there is not enough money at the moment and then I have to take a small amount of money before the salary on this site PayDay Say

Profile icon
19ecal

if you just want to save the changes, replit does this automatically

Profile icon
Muffinlavania

If you want to save the salary at the end, you can just pop it into a .txt file

salary=1000 #(Just an example) f=open('f.txt','w') #the 'w' at the end can be changed to an 'a' to get it to add stuff, instead of overwriting everything #f is our txt file f.write(salary) #writing the salary to the file, this file auto saves
Profile icon
19ecal

@Muffinlavania You will need to close it at the end when you're done with f.close(), or use with like this

with open("f.txt","w") as f: #Again you can use "a" to just append to the end of the file f.write(salary) #With closes the file for you when you leave the indented block, #so you have to do anything you want to do with the file inside the #indent
Profile icon
Muffinlavania

@19ecal yea sorry, forgot to include that (but everything else should work)
and f.close() is a bit easier in my opinion

Profile icon
RYANTADIPARTHI

Solution

everything seems to be working. But if you want to save the values and all. Two things.

  • try repl database
  • dump all info in a file.

here's a tutorial on the repl database.

https://docs.repl.it/misc/database

any of them should work