Question: this is my code for the first three steps only , please edit my code to add more than one course in the file as
this is my code for the first three steps only , please edit my code to add more than one course in the file as the notepad file in the first picture in python please , please just edit my code dont give me new one if there is an error i will give you dislike. # import the library to check the file import os.path def main(): # take input for student id and store in studentId variable studentId = (input("Enter the Student ID :")) if len(studentId) 7: print("Error in the number length") # check the path of file in directory # if it found then return true else false file_exists = os.path.exists(studentId + '.txt') # if it found then print error message if file_exists: print("File Already Exist") else: # create the new file and open in write mode if len(studentId) ==7 : f = open(studentId + ".txt", "w+") # take input for batch and store it in batch variable year = input("Enter the year : ") import re if re.match(r'[0-9]{4}-[0-9]{4}$', year): # take input for semester and store it in sem variable sem = (input("Enter the Semester :")) if re.match(r'[0-9]{1}$', sem): # take input for courses and store in course variable courses = input("Enter the courses : ") import re if re.match(r'[A-Z]{4}[0-9]{4}(\s)[0-9]{2}$', courses): # write the data to file f.write("Year/Semester ; Courses with grades ") f.write(year + "/" + sem + " ; " + courses) # close the file f.close() # call the main function if __name__ == "__main__": main() def update(): stuid = input("Enter student id : ") if len(stuid) 7: print("Error in the number length") if len(stuid) == 7: stufile = stuid + ".txt" # getting the filename from student it course = input("Enter course to be changed") grade = input("enter the new grade") f = open(stufile, "r") # opening the student file l = f.readlines() # getting list of lines of student file temp = l[1] # getting the courses and grades line index = temp.find(course) # getting the index of couse temp = temp[:index + len(course) + 1] + grade + temp[ index + len(course) + 1 + 2:] # updating the record with course l[1] = temp # updating the list # for i in l: #printing the update file for debugging # print(i) f.close() f = open(stufile, "w") # open the file for writing the updated lines f.writelines(l) f.close() 

In this project, the system will provide operations related to students record system like add a new student record, update, search.... Each student record must be saved in text file. The structure of the file must be as shown below: 1193751 - Notepad 0 x File Edit Format View Help Year/Semester ; Cources with grades 2021-2022/1 ; ENCS2380 81, ENCS2110 87, ENCS311 90, ENEE2304 75, ENEE2307 93 Where: Year/semester represent the academic year and the current semester. For example: 2021-2022 represent the academic year, 1 represents first semester (2 for second semester, 3 for summer semester) Courses with grades: lists of course taken in the academic year/semester. Each student must have separated file and the name of the file will be the student ID. Scenario: First the user must login to the system. Here there are two types of users: student and admin Then, the program will print the available list of options which is based on the user type The option available includes the following: O Admin options: 1. Add a new record file: here the program must ask to enter student ID. The program must raise an error if the ID is not unique. 2. Add new semester with student course and grades: here the program must ask to enter the required information (student ID, year/semester, courses and grades). The system must raise an error if there is missing information or the information in wrong format. 3. Update: here the system must ask for student ID and the name of the course to be change and the new grade. 4. Student statistics: first the program must ask for student ID. The program will print information such as number of taken hours, remaining courses (you need to create a list/file that contains all ENCS and ENEE courses for computer engineering program), average per semester, overall average 5. Global statistics: here the program must print information regarding all student such as overall students average, average hours per semester, plot the distribution of their grades (histogram). 6. Searching: here the system must retrieve the ID of the students that satisfy the given criteria. Here you can search for the following: based on average, taken hours. For example: retrieve the IDs that have an average grater/less/equal than 70. o Students' options: 1. Student statistics: here the program must print information such as number of taken hours, remaining courses, average per semester, overall average. 2. Global statistics: here the program must print information regarding all student such as overall average, average hours per semester, plot the distribution of their grades
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
