PW Akshay

Generation

generate functionFri, 02 Dec 2022

Create a binary file with roll number, name and marks. Input a roll number and update the marks

import os def update_marks(roll_number, marks): f = open("students_marks.dat", "rb+") f.seek(roll_number * 24) # get rid of the trailing \n name = f.read(20).strip() f.seek(roll_number * 24) f.write(name + str(marks)) f.close()

Questions about programming?Chat with your personal AI assistant