Math, asked by JoshuaJV5193, 10 months ago

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

Answers

Answered by sagarnirapure914
10

Answer:

You have a record of N students. Each record contains the student's name, and their percent marks in Maths, Physics and Chemistry. The

# marks can be floating values. The user enters some integer N followed by the names and marks for N students. You are required to save

# the record in a dictionary data type. The user then enters a student's name. Output the average percentage marks obtained by that

# student, correct to two decimal places.

# Input Format

# The first line contains the integer N, the number of students. The next N lines contains the name and marks obtained by that student

# separated by a space. The final line contains the name of a particular student previously listed.

# Constraints

# 2 <= N <= 10

# 0 <= Marks <= 100

# Output Format

# Print one line: The average of the marks obtained by the particular student correct to 2 decimal places.

# Enter your code here. Read input from STDIN. Print output to STDOUT

N = int(raw_input())

results = {}

for i in range(N):

a = raw_input().split(' ')

results[a[0]] = [float(x) for x in a[1:]]

student = raw_input()

print "%.2f" %(sum(results[student]

Hope it helps

Answered by mangalyogesh22
2

n=int(input())

d={}

for i in range(n):

   name,m1,m2,m3=input().split(" ")

   d1={name:[float(m1),float(m2),float(m3)]}

   d.update(d1)

s=0

p=input()

for i in d.keys():

   if(i==p):

       t=d[i]

       for i in t:

           s=s+float(i)

       print("{0:.2f}".format(s/3))

Similar questions