for score_item in scores_list: print("Score of {0} achieved by {1}".format(score_item[0], score_item[1])) elif sorting_method == "3": scores_list = current_class.get_class_average_scores_descending() if len(scores_list) == 0: print("This class hasn't had any scores yet.") else: for score_item in scores_list: print("Average score of {0} achieved by {1}".format(score_item[0], score_item[1])) else: print("Invalid choice.") elif choice == "3": # Creates new classes on request. See data_structure.py os.chdir(data_directory) from quizlib import data_structure data_structure.create_new_classes(class_object_list) elif choice == "4": # Creates new students on request. See data_structure.py select_class_id() current_class = class_object_list[class_id] from quizlib import data_structure data_structure.create_new_students(current_class) else: print("Please enter a valid choice.") print()
"""This file here is run automatically before anything else""" quizlib_directory = os.getcwd() # data_directory = "" # if __name__ != "__main__": print("Checking for existing data...") from quizlib import data_structure if not os.path.exists("../data"): os.chdir("..") os.mkdir("data") os.chdir("data") data_directory = os.getcwd() print("Data folder at: {}".format(data_directory)) data_structure.create_new_classes([], True) print() else: os.chdir("../data") data_directory = os.getcwd() print("Data folder at: {}".format(data_directory)) print("Initial file setup has already been run. If you want to reset all data, delete the data folder.") print() os.chdir("../quizlib") def get_class_directory(class_id): os.chdir(data_directory) for directory in os.listdir(os.getcwd()): if str(class_id) == directory.split(" - ")[0]: