Hey internet mates here we are going to make a python program to create a .txt file and to enter data as per given by user. In this sample we are going to take marks as entries from the user.
file=open('marks.txt',"a+") n=int(input("ENTER THE NO OF STUDENTS YOU WANTS TO ENTER")) for x in range(n): a=str(input("Enter Name:-")) b=str(input("Enter Roll No.:-")) c=str(input("Enter marks of Maths:-")) d=str(input("Enter marks of Physics:-")) e=str(input("Enter marks of Chemistry:-")) f=" " file.write(a+f+b+f+c+f+d+f+e+"\n") file.close()