Store Student Data

Store Student Data

Wood Crust International School conducts a talent search test for the middle schools students.  The management wants to store students’ names and their scores in the test in a file for their future references.  You are asked to write a Python program to read names and scores of the participants and to store them in a file. Use simple write() to accomplish this task.

Note: File name should be “output_data.txt”

Sample Input:

Enter number of students: 3

For student1

Enter name: Harshika

Enter the score: 98

For student2

Enter name: Laya

Enter the score: 99

For student3

Enter name: Johan

Enter the score: 100output_data.txt will contain:

Name: Harshika Score: 98
Name: Laya Score: 99
Name: Johan Score: 100

Code :-

n=int(input("Enter number of students: "))
for i in range(1,n+1):
    name=input("Enter name: ")
    score=input("Enter the score: ")
    line="Name: "+name+" "+"Score: "+score

Leave a Comment

Your email address will not be published. Required fields are marked *