-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindingThePercentage.py
More file actions
58 lines (37 loc) · 1.33 KB
/
findingThePercentage.py
File metadata and controls
58 lines (37 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""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.
Input Format
The first line contains the integer
, the number of students. The next
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
Output Format
Print one line: The average of the marks obtained by the particular student correct to 2 decimal places.
Sample Input 0
3
Krishna 67 68 69
Arjun 70 98 63
Malika 52 56 60
Malika
Sample Output 0
56.00
Explanation 0
Marks for Malika are
whose average is
Sample Input 1
2
Harsh 25 26.5 28
Anurag 26 28 30
Harsh
Sample Output 1
26.50 """
#solution
n = int(input())
student_marks = {}
for i in range(0,n):
s_info=input()
name=s_info.split()
student_marks[name[0]]=[float(name[1]),float(name[2]),float(name[3])]
find_name=input()
if find_name in student_marks:
print("{0:.2f}".format(sum(student_marks[find_name])/3.0))