@mvidberg/

PPS2.py

Python

No description

fork
loading
Files
  • main.py
  • grades.txt
  • reportcard.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
file1 = open ("grades.txt","r")
name = (file1.readline())
print (name)
list1 = []
sum=0
for x in range (4):
  list1.append(file1.readline())
  list1[x]=int(list1[x])
  sum = sum+list1[x]
print(list1)
sum = sum/4
print(sum)
file1.close()
file2 = open("reportcard.txt","w")
file2.write("test")
#file2.write("Student name "+name)
#file2.write("Mark 1/n"+str(list1[0]))
#file2.write("Mark 2/n"+str(list1[1]))
#file2.write("Mark 3/n"+str(list1[2]))
#file2.write("Mark 4/n"+str(list1[3]))
#file2.write("Average mark %"+str(sum))
file2.close()