Dcoder icon

The Report Card! @ Dcoder

By Lochard | As a newbie programmer | 23 Jun 2023


Problem: Priyanka is Professor at Zing University. Help the professor in assigning grades to her students. 

 The mean score of three subjects is to graded into 'A', 'B', 'C' or 'D' or 'F' depending upon the marks scored. 

 For the score >90 and score =<100, 'A' is graded. 

 For score >80 and score =<90, 'B' is graded. 

 For the score >70 and score <=80, 'C' is graded. 

 For the score >60 and score <=70, 'D' is graded. 

 For the score =< 60 'F' is graded. 

Input: Input contains the marks obtained by student in 3 subjects separated by a space.

Output: Output should be the grade scored by the student.

Constraints: 0 ≤ Marks obtained in each subject ≤ 100 

Sample Input: 100 75 54

Sample Output: 

C

m = sum(map(int, input().split())) / 3
if m > 90:
  print('A')
elif m > 80:
  print('B')
elif m > 70:
  print('C')
elif m > 60:
  print('D')
else:
  print('F')

How do you rate this article?

1


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.