u/LibraryAgreeable4970

been coding this for hours and kinda gonna give up until tomorrow.

from cryptography.fernet import Fernet
def load_key():
        file = open("key.key", "rb")
        key = file.read()
        file.close()
        return key





key = load_key()
fer =Fernet(key)
'''
def write_key():
        key = Fernet.generate_key()
        with open("key.key", "wb") as key_file:
                key_file.write(key) '''




def view():
        with open('passwords.txt', 'r') as f:
                for line in f.readlines():
                        data = line.rstrip()
                        user, passw = data.split("|")
                        print("user:", user, "password:", fer.decrypt(passw.encode()).decode())
def add():
        name = input('account name: ')
        pwd = input("password : ")


        with open('passwords.txt', 'a') as f:
                f.write(name + "|" + fer.encrypt(pwd.encode()).decode() + "\n")




while True:
        mode = input("would you like to add a new password or view existing ones (view,add)").lower()
        if mode == "q":
                break


        if mode == "view" :
                view()
        elif mode == "add" :
                add()
        else:
                print("invalid mode.")
                continue
reddit.com
u/LibraryAgreeable4970 — 4 days ago

i made this script during my first day and fixing errors on linux terminal python. ill try make it from scratch again to ensure memorisation.

import time

import sys

def smoothprint(text):

for char in text:

print(char, end = "",flush = True)

time.sleep(0.08)

print()

answer = input("do you wish to play shadow slave")

if answer == "yes":

smoothprint("you wake up in a dark room, facing two doors")

else :

smoothprint("\033[91m" + "admin strikes you"+ "\033[0m")

sys.exit()

answer2 = input("do you pick the left door or the right?")

if answer2 == "left door":

smoothprint("\033[91m" + "you open the door and a demon rips your spleen" + "\033[0m")

sys.exit()

else :

smoothprint("you open the door and a small woman runs away,")

answer3 = input("will you follow the women")

if answer3 == "yes" :

smoothprint("the woman leads you to a separate room where the admins of the game are,")

smoothprint("the admins strap you and the woman down, they want you to play a game")

else :

smoothprint("\033[91m" + "you become lost and realise what the woman was running from," + "\033[0m")

sys.exit()

smoothprint("your going to decide who is going to die, OR YOU BOTH WILL")

answer4 = input("who will die, you, or the woman")

if answer4 == "the woman" :

smoothprint("the admin shoots you for your selfishness")

sys.exit()

else :

smoothprint("the admin shoots the woman in her head..")

smoothprint("you are forgiven for your selflessness")

reddit.com
u/LibraryAgreeable4970 — 7 days ago
▲ 2 r/GCSE

missing conditional offer

Basically my offer was grade 8 in maths, 7-7 in science and 5s in 7 gcse or above. im certain that i got both the first two conditions but for 5s in 7 gcses or above if one of my english grades is 4 then i miss the offer, what would happen if so.-honest

reddit.com
u/LibraryAgreeable4970 — 10 days ago
▲ 1 r/alevel

year 11 summer. students where do i start to get ahead of a level maths and a level comp sci

it feels like alot of content but i didnt take compsci at gcse so its a top priority can you guys maybe give a list of things for maths and compsci and where to find resources;

reddit.com
u/LibraryAgreeable4970 — 11 days ago