I need help with just one line. I need an "F" to be displayed on the same line the student with 45 points. I keep getting the "F" to display on a new line below the 45. I guess something is wrong with my if statement. I also need to display the % symbol after the 83.3. I'm using python 3.5.1. Thank you so much for any help.
def main():
file_students = open("student_points.txt" , "r")
stu_name = file_students.readline()
num_stu = 0
f_students = 1
pass_students = 5/6
print("Student\t\t\tPoints\t\tGrade")
print("-------------------------------------\n")
while stu_name != "":
stu_name = stu_name.rstrip("\n")
stu_points = file_students.readline()
stu_points = int(stu_points)
print(stu_name, "\t\t", stu_points, sep="")
num_stu += 1
if stu_points < 60:
print("\t\t\t\t\tF")
stu_name = file_students.readline()
file_students.close()
print()
print("Number of students processed=", num_stu)
print("% of students who passed=" , format(pass_students * 100 , ".1f"))
main()
The students and their corresponding grades are:
Johnson Smith: 93
Maryanne James: 80
Stanton Chase: 45
Mildred Morris: 90
George Deitz: 89
Maisie Kling: 79