title: What method to use in "ATM" based program
body: <p>I've started with a assignment for a ATM code, I'm supposed to use text file in some way or another. so far I've got this: </p>
  
  <pre><code>print("Hello, and welcome to the ATM machine!\n")
  
  a_pin = {1111, 2222, 3333, 4444}
  
  def process():
      pin = int(input("\nplease enter below your 4-digit pin number: "))
      if pin in a_pin:
          if pin == (1111):
              f = open("a.txt", "r")
          elif pin == (2222):
              f = open("b.txt", "r")
          elif pin == (3333):
              f = open("c.txt", "r")
          elif pin == (4444):
              f = open("d.txt", "r")
          print(
      """
          MENU:
          1: view your current balance
          2: make a withdraw
          3: make a deposit
          4: exit
  
       """)
  
          option = input("\nwhat would you like to do? ")
  
          if option == "1":
              print(f.read())
          elif option == "2":
              y = str(input("\nHow much would you like you like to withdraw? "))
              f.write(y)
              print("Excellent, your transaction is complete!")
          elif option == "3":
              z = str(input("\nHow much would you like to deposit? "))
              f.write(z)
              print("Excellent, your transaction is complete!")
          elif option == "4":
              input("Please press the enter key to exit.")
  
  
  
      else:
          print("\nthat was a wrong pin number!")
          x = input("\nwould you like to try again? '(y/n)' ")
          if x == "y":
              process()
          else:
              input("\npress the enter key to exit.")
  
  process()
  </code></pre>
  
  <p>The code works as of now, but I want to save some time by asking how to most effectively overwrite content on the text files when withdrawing/depositing. 
  I was thinking of pickled files... but will be very happy for any suggestions, since normal commands like write dont really work for this task, if i want to display the new ammount to user after a withdraw/deposit.
  Many thanks!</p>