()
| 4 | |
| 5 | |
| 6 | def update(): |
| 7 | with open("studrec.dat", "rb+") as File: |
| 8 | value = pickle.load(File) |
| 9 | found = False |
| 10 | roll = int(input("Enter the roll number of the record")) |
| 11 | |
| 12 | for i in value: |
| 13 | if roll == i[0]: |
| 14 | print(f"current name {i[1]}") |
| 15 | print(f"current marks {i[2]}") |
| 16 | i[1] = input("Enter the new name") |
| 17 | i[2] = int(input("Enter the new marks")) |
| 18 | found = True |
| 19 | |
| 20 | if not found: |
| 21 | print("Record not found") |
| 22 | |
| 23 | else: |
| 24 | pickle.dump(value, File) |
| 25 | File.seek(0) |
| 26 | print(pickle.load(File)) |
| 27 | |
| 28 | |
| 29 | update() |
no test coverage detected