2 Removing class A unique record in the database is identified by ID and Course. Using only ID will return many records of the same student who have multiple courses and using only course titles will return many students who have the same course. Therefore, to identify a single record and remove it, we need to use both. By selecting this option, the program should show to the user two other options а. Вy ID b. Вy Course Once a user selects By ID (option a), the program asks the user to enter an ID to search for. Then, the program returns all records that have the same ID. Suppose a user selected this option and entered 202010000 to look for. Then, your program should show the records numbered as follows 1. 202010000 Asem ICS104 0 100 100 200 2. 202010000 Asem ICS108 2 75 -1 75 The user, then, can select one of these showed records by entering the corresponding number to be removed from the data file. So, if the user enters (1) then your program should remove the first record from the data file permanently. Note: Similar situation can be produced with By Course. The Course column will be the same, the student names and information will be different!
Hi need you to add the feature that is in the picture to the code down below, please
def add():
id = input("Enter ID:")
f = open("data.txt", "r")
id_list = []
lines = f.readlines()
if lines != "":
for line in lines:
token = line.split(" ")
id_list.append(token[0])
for i in id_list:
if i == id:
print("The student record is already in the
return
f.close()
file = open("data.txt", "a")
name = input("Enter name: ")
course = input("Enter course: ")
absences = int(input("Enter absences: "))
exam1 = int(input("Enter exam 1 grade: "))
exam2 = int(input("Enter exam 2 grade: "))
marks = int(input("Enter Total Marks: "))
s = id+" "+name+" "+course+" "+str(absences)+" "+str(exam1)+" "+str(exam2)+" "+str(marks)+"\n"
file.write(s)
file.close()
while True:
print("1.Add a student")
print("Any other numeric to terminate")
choice = int(input())
if choice == 1:
add()
else:
break
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images