Python 3.6 please Your task: You need to generate a report that tells you two th
ID: 3734905 • Letter: P
Question
Python 3.6 please
Your task: You need to generate a report that tells you two things about the students that are having difficulties achieving the grades they want: 1. Which courses do you need to be concerned about? A grade will be concerning only when the current grade is at or below the "warning" level, but still above the semester "objective" (i.e. it is the score below which the student is in danger of falling below their desired grade) 2. Which courses where the student is in trouble? A grade will indicate "trouble" when the current grade is at or below the “objective" for the semester * Note: These statuses are mutually exclusive, so courses that appear in the "warning" status should not appear in the "trouble" status and vice versa. Here is an example of a student's performance in Math and English: Math cur Math ob 76 Math warEngl cur 79 Engl ob 78 Engl war 81 70 This student would be considered to have a "concerning" status for Math, and a "trouble" status for English. The report should contain a block for each student how has at least one "concerning" or "trouble" subject. The block should include the student's full name on the first line, followed by a list of the "concerning" courses, followed by a list of trouble" courses. For the "concerning" courses, the report should output the current grade and the warning grade for the subject in case, while for the "trouble" courses, the report should output the current grade and the objective grade. The report you will generate should look like in the sample output below Student name: Jane Testcase Concerning Courses: Current Math grade: 77, Warning Math grade: 79 Trouble Courses: Current English grade: 70, Objective English grade: 78Explanation / Answer
'''
WRITTEN IN PYTHON 3.6 .
I ACTUALLY DON'T KNOW HOW TO TAKE INPUT FOR YOUR QUESTION
DOES I HAVE TO TAKE EACH INPUT FROM CONSOLE (OR) FROM THE FILE.
IF IT IS THE CONSOLE THE INPUT FORMATE I HAVE TAKEN WAS
NO.OF STUDENTS
NO.OF SUBJECTS
NAME OF I_th SUBJECT
NAME OF I_th STUDENT
CURRENT MARKS OF I_th STUDENT for J_th SUBJECT , OBJECTIVE OF MARKS FOR CURRENT SUBJECT , WARNING_LEVEL_MARKS FOR THAT SUBJECT
========================
IF IT IS THE FILE:
FILE SHOULD BE IN THE FOLLOWING FORMAT:
STUDENT NAME IN FIRST LINE FOLLOWED BY SPACE FOLLOWED BY NO OF SUBJECTS(m):
SUBJECT_NAME FOLLWED BY CURRENT_MARKS, OBJECTIVE_MARKS,WARNING_LEVEL_MARKS IN THE NEXT 'm' LINES
JUST REMOVE COMMENTS TO USE ONE OF THE INPUT FORMATS TO USE .
HOPE YOU DON'T MIND
NEXT TIME PLEASE INCLUDE INPUT FORMAT
'''
#======================= Input From Console ================
n,m=map(int,input("Enter No.of Studnets and No.Of Subjects (Ex:-10 3: ").strip().split(' '))
sub = []
for i in range(m):
#START OF FOR LOOP
sub.append(input("Enter Subject name : "))
#END OF FOR LOOP
for j in range(n):
#START OF I LOOP
stu_name = input("Enter Sutdent Name : ");
con_sub = []
tro_sub = []
con_count = 0
tro_count = 0
for j in range(m):
#START OF J LOOP
cur_m,obj_m,warn_m = map(int,input("Enter Current , Objective and Warn_Level Marks of "+sub[j]+" : ").strip().split(' '))
is_con = False
is_tro = False
if(cur_m<warn_m and cur_m>=obj_m):
#START OF IF
is_con = True
con_count+=1
#END OF IF
elif(cur_m<obj_m):
#START OF ELIF
is_tro = True
tro_count+=1
#END OF ELIF
if(is_con):
#START OF IF
con_sub.append([j,cur_m,warn_m])
#END OF IF
if(is_tro):
#START OF IF
tro_sub.append([j,cur_m,obj_m])
#ENF OF IF
print(stu_name+" :")
print(" Concerning Cources :")
if(con_count==0):
#START OF IF
print(" None")
#END OF IF
for rec in con_sub:
#START OF REC LOOP
print(" Current",sub[rec[0]],"Grade:",rec[1],", Warning",sub[rec[0]],"Grade:",rec[2])
#END OF REC LOOP
print(" Trouble Cources : ")
if(tro_count==0):
#START OF REC LOOP
print(" None")
#END OF REC LOOP
for rec in tro_sub:
#START OF REC LOOP
print(" Current",sub[rec[0]],"Grade:",rec[1],", Objective",sub[rec[0]],"Grade:",rec[2])
#END OF REC LOOP
#================== End of Input From Console ==========================
f_name = input("Enter Record File :")
f = open(f_name,"r")
x="0"
while(x):
#START OF WHILE LOOP
x=f.readline() #first line is Student name followed by no of subjects
if(len(x)>0): #first line should contains some data
#START OF IF
stu_details = x.strip().split(" ")
stu_name = stu_details[0]
no_of_sub = int(stu_details[1])
con_sub = []
tro_sub = []
con_count = 0
tro_count = 0
for i in range(no_of_sub): #reading next n no of subjects
#START OF I LOOP
x = f.readline()
sub_details = x.strip().split(' ')
sub_name = sub_details[0]
cur_m = int(sub_details[1])
obj_m = int(sub_details[2])
warn_m = int(sub_details[3])
is_con = False
is_tro = False
if(cur_m<warn_m and cur_m>=obj_m):
#START OF IF
is_con = True
con_count+=1
#END OF IF
elif(cur_m<obj_m):
#START OF ELIF
is_tro = True
tro_count+=1
#END OF ELIF
if(is_con):
#START OF IF
con_sub.append([sub_name,cur_m,warn_m])
#END OF IF
if(is_tro):
#START OF IF
tro_sub.append([sub_name,cur_m,obj_m])
#END OF IF
print(stu_name+" :")
print(" Concerning Cources :")
if(con_count==0):
#START OF IF
print(" None")
#END OF IF
for rec in con_sub:
#START OF REC LOOP
print(" Current",rec[0],"Grade:",rec[1],", Warning",rec[0],"Grade:",rec[2])
#END OF REC LOOP
if(tro_count==0):
#START OF IF
print(" None")
#END OF IF
print(" Trouble Cources: ")
for rec in tro_sub:
#START OF REC LOOP
print(" Current",rec[0],"Grade:",rec[1],", Objective",rec[0],"Grade:",rec[2])
#END OF REC LOOP
#END OF IF
#END OF WHILE LOOP
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.