title: Password creation, encrypting, and saving
body: <p>I know this is probably very simple but I'm a newbie and in first year studying Cyber Security</p>
  
  <p>I've trawled the site and other sites and either most script is in python 2 or just doesn't work for me</p>
  
  <p>I am using repl to test my code to make sure it works</p>
  
  <p><em>This is the question we have to complete for our logbook</em>:</p>
  
  <blockquote>
    <p>Write a program which asks the user if they want to encode or decode
    If encode, ask for an input to encode and a reference
    Save the encoded value in a file named with the reference
    If decode, ask if the user wants to decode from previous file or from a string
    If file, ask the user for reference then read the relevant file and print decoded value
    If string, ask user for base 64 string and print decoded value</p>
  </blockquote>
  
  <hr>
  
  <p>This is my current script, I have managed to get user to enter password which then gets encrypted and decrypted as requested, everything works fine, but <strong>am not sure how to add a "reference" for the user as they create a password or save it into a file and ask the user if they want to decode from file or string</strong>:</p>
  
  <pre><code># Note:encoding from base64 and decoding*
  
  from base64 import b64encode
  from base64 import b64decode
  
  # Note:user input a password*
  
  Password1 = input("Enter password")
  encoded = b64encode(Password1.encode())
  
  # Note:prints an encoded password*
  
  print (encoded.decode('ascii'))
  
  # Note:decode user input password*
  
  decoded = b64decode(encoded)
  print (decoded)
  
  # Note:figure how to save password into a file*
  
  save_path = ('passwords')
  name_of_file = input ("What is the name of the file: ")
  </code></pre>