File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
1 File handle/File handle binary Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1010We have to find weak students and bright students.
1111"""
1212
13-
1413## Find bright students and weak students
1514
1615from dotenv import load_dotenv
@@ -35,7 +34,6 @@ def remcount():
3534 val = pickle .load (F )
3635 count = 0
3736 weak_students = []
38-
3937
4038 for student in val :
4139 if student [2 ] <= 40 :
@@ -45,9 +43,9 @@ def remcount():
4543 print (f"the total number of weak students are { count } " )
4644 print (f"The weak students are { weak_students } " )
4745
48-
4946 # ! highest marks is the key here first marks
50-
47+
48+
5149def firstmark ():
5250 with open (student_record , "rb" ) as F :
5351 val = pickle .load (F )
@@ -63,5 +61,6 @@ def firstmark():
6361 count += 1
6462 print ("The total number of students who secured top marks are" , count )
6563
64+
6665remcount ()
67- firstmark ()
66+ firstmark ()
Original file line number Diff line number Diff line change 33import pickle
44from dotenv import load_dotenv
55
6+
67def search ():
78 with open ("student_records.pkl" , "rb" ) as F :
89 # your file path will be different
9- search = True
10+ search = True
1011 rno = int (input ("Enter the roll number of the student" ))
1112
1213 for i in pickle .load (F ):
Original file line number Diff line number Diff line change 33import pickle
44import os
55from dotenv import load_dotenv
6+
67base = os .path .dirname (__file__ )
78load_dotenv (os .path .join (base , ".env" ))
89student_record = os .getenv ("STUDENTS_RECORD_FILE" )
910
11+
1012def update ():
1113 with open (student_record , "rb" ) as F :
1214 S = pickle .load (F )
@@ -23,9 +25,8 @@ def update():
2325 if found :
2426 print ("Record not found" )
2527
26-
2728 with open (student_record , "wb" ) as F :
2829 pickle .dump (S , F )
2930
3031
31- update ()
32+ update ()
You can’t perform that action at this time.
0 commit comments