-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfinding_the_percentage
More file actions
39 lines (28 loc) · 1.33 KB
/
finding_the_percentage
File metadata and controls
39 lines (28 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
# Finding the percentage
# 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
-----------------------------------------------------------
def main():
s=student_marks[query_name]
s=sum(s)/3
print("%.2f" %s)
if __name__ == '__main__':
n = int(input())
student_marks = {}
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
query_name = input()
main()