+1 (315) 557-6473 

Create A Stamp Selling Program in The Python Assignment Solution.


Instructions

Objective
Write a python assignment program to create a stamp selling system.

Requirements and Specifications

Create a stamp selling program in python
Create a stamp selling program in python 1
Create a stamp selling program in python 2

Source Code

STUDENT_ID = 28211718

def encrypt(plain):

    key = STUDENT_ID % 128

    encrypted = ''

    for c in plain:

        encrypted += chr(ord(c) + key)

    return encrypted

def decrypt(data):

    key = STUDENT_ID % 128

    decrypted = ''

    for c in data:

        decrypted += chr(ord(c) - key)

    return decrypted

def get_users():

    filename = 'user_details.txt'

    try:

        f = open(filename, 'r')

        return f.read().splitlines()

    except:

        return []

def login(user, password):

    return encrypt(user + ':' + password) in get_users()

print(login('user', '1234'))