Skip to content

Instantly share code, notes, and snippets.

@Xzer0X
Created December 3, 2017 18:10
Show Gist options
  • Save Xzer0X/d6b90cc53d905beec8ca419034dd6f0f to your computer and use it in GitHub Desktop.
Save Xzer0X/d6b90cc53d905beec8ca419034dd6f0f to your computer and use it in GitHub Desktop.
A small program allowing you to make an "account", sign in or log off, and take notes.
import linecache
import difflib
def Restart():
def doStuff():
option = input("What would you like to do: {add website|log out|take note|see websites|see notes}")
if option == "take note":
file = open("Notes.txt", "a")
note = input("Enter your note:")
file.writelines(note + "\n")
file.close()
doStuff()
if option == "log out":
Restart()
if option == "add website":
file = open("Info.txt", "a")
website = input("Enter the websites URL:")
file.writelines(website + "\n")
file.close()
doStuff()
if option == "see websites":
file = open("Info.txt", "r")
wbsites = file.read()
print (wbsites)
file.close()
doStuff()
if option == "see notes":
file = open("Notes.txt", "r")
NoteS = file.read()
print (NoteS)
doStuff()
else:
print("That is not one of the options.")
doStuff()
def getAccountInfo():
file = open("Accounts.txt", "w")
nameFirst = input("Please enter your first name:")
nameLast = input("Please enter your last name:")
key = input("Please enter a password:")
key2 = input("Please enter your password again:")
file.write(nameFirst + "\n")
file.write(nameLast + "\n")
if key == key2:
file.write(key)
else:
print("Those passwords were not the same, please type them again.")
file.close()
Restart()
def signIn():
file = open("Accounts.txt", "r")
enterFirst = input("Please enter your first name:")
enterLast = input("Please enter your last name:")
enterKey = input("Please enter your password:")
realFirst = file.readline()
realLast = linecache.getline("Accounts.txt", 2)
realKey = linecache.getline("Accounts.txt", 3)
if enterFirst == realFirst.strip(' \n') and enterLast == realLast.strip(' \n') and enterKey == realKey.strip(' \n'):
doStuff()
else:
print("Name or password is incorrect")
signIn()
file.close()
choice = input("What would you like to do: {make an account|sign in}")
if choice == "make an account":
getAccountInfo()
if choice == "sign in":
signIn()
Restart()
Delete all text in the .txt files before starting the program
Delete all text in the .txt files before starting the program
Delete all text in the .txt files before starting the program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment