I am trying to write a program for a GPA Calculator that lets the user input each Subject, with subcategories of subject name, final grade, and the credits it gives. I want this program to be able to be accessed over and over, and want to know a way to store data, and access it and be able to pull the data from the storage, as well as changing and adding new data. I want to know how to do this, so I can store the users, with username and password, and their gpa data.
class User:
"""This class represents users in this program"""
def __init__(self, username, password):
self.username = username
self.password = password
class Subject:
"""This class represents what is needed to calculate gpa with classes"""
def __init__(self, sub_name, final_grade, credit):
self.sub_name = sub_name
self.final_grade = final_grade
self.credit = credit
users = {}
username = str(input("Username: "))
password = str(input("Password: "))
users[username] = User(username)
users[password] = User(password)