AVERAGE OF MARKS |Programming_info || python_problem_18

 You have a record of students. Each record contains the student's name and their percentage marks in Maths, Physics, and Chemistry. The marks can be floating values. The user enters some integer followed by the names and marks of students. You are required to save the record in a dictionary data type. The user then enters a student's name. The output is the average percentage marks obtained by that student, correct to two decimal places.

                              

 

Input and Output format:
The first line contains the integer, which indicates the number of students, 'n'.
The next 'n' lines contain the name and marks obtained by that student separated by a space. The final line contains the name of a particular student previously listed to find the average mark of him.
The output is the average of the marks obtained by the particular student correct to 2 decimal places.

Note: Use Dictionary concept to solve the problem.
Sample Input 1:
4
aaa 35 67 89
bbb 45 46 48
ccc 78 78 78
ddd 78 90 89
ddd
Sample Output 1:
Average Mark of is : 85.67

 

Sample Input 2:
3
aaa 46 78 89
bbb 34 68 90
ccc 13 56 34
ccc
Sample Output 2:
Average Mark of is : 34.33

Solution:
d=dict()
n=int(input())
for i in range(0,n):
    name,m1,m2,m3=input().split()
    d[name]=[int(m1),int(m2),int(m3)]
s=input()
if s in d.keys():
    print("Average Mark of is : {:.2f}".format(sum(d[s])/3))

Share:

2 comments:

  1. I have read the entire blog carefully and it's amazing content, thanks a lot for sharing this informative content with us. I have written content on the topic of Difference between Coin and token. and I recommended you to please visit the link and share your review with us.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support