Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON Write a PYTHON program named program6_1.py that prompts the user to enter

ID: 3795870 • Letter: P

Question

PYTHON

Write a PYTHON program named program6_1.py that prompts the user to enter six test names and their scores and writes them to a text file named tests.txt. You must use a loop. Each input should be written to its own line in the file. The program should generate a confirmation message when done. See SAMPLE OUTPUT.

SAMPLE OUTPUT

Entering six tests and scores

Enter test name objects

Enter % score on this test 88

Enter test name loops

Enter % score on this test 95

Enter test name selections

Enter % score on this test 86

Enter test name variables

Enter % score on this test 82

Enter test name files

Enter % score on this test 100

Enter test name functions

Enter % score on this test 80

File was created successfully

Explanation / Answer

print "Entering six tests and scores"
file=open("tests.txt","w")
input = 0
while(input<6):
   name = raw_input("Enter test name:")
   score = int(raw_input("Enter % score on this test:"))
   file.write(name+" "+str(score)+" ")
   input = input+1
print "File was created successfully "