hi, i'm new in python programming
i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) .
http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A3/a3.pdf
txt file:http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A3/grades1.txt
i was able to extract the 6th column with this code
-
infile = open('grades1.txt','r')
-
all_lines = infile.readlines()
-
all_lines = all_lines[1:]
-
all_lines = all_lines[:-2]
-
i need help in assigning a grade to the results
and that's what i got so far but it doesn't seem to be working
- A+ =[10]
-
A = [9,10)
-
A- =[8,9)
-
B+ =[7,8)
-
B =[6,7)
-
B- =[5,6)
-
C+ =[4,5)
-
C =[3,4)
-
D+ =[2,3)
-
F =[0,1)
-
-
-
grades=["ABCDA"]
-
i=0
-
total=0
-
while i<len(grades):
-
if grades[i] =='A':
-
total=total+1
-
i=i+1
-
print total
any help would be really appreciated