I have the following task:
We will write a program called student_register.py that allows students to register for an exam venue.
First, ask the user how many students are registering.
Create a for loop that runs for that amount of students
Each loop asks for the student to enter their ID number.
Write each of the ID numbers to a Text File called reg_form.txt
This will be used as an attendance register that they will sign when they arrive at the exam venue.
I think the following code I have is close as it saves the text file but only saves the first inputted ID number and does not display the others.
students = int(input("Please enter the amount of students registered."))
id_number = ""
for a in range (0, students):
id_number = (int(input("Please enter student ID numbers.")))
id_number = id_number + 1
reg_form = open('reg_form.txt', 'w')
reg_form.write("Student ID numbers: \n" + str(id_number))
print ("Thank you, ID numbers saved to txt file reg_form")