# Finding the percentage in Python Hacker Rank Solution

Hello coders, In this post, you will learn how to solve the Finding the percentage in Python Hacker Rank Solution. This problem is a part of the Python Hacker Rank series.

## Finding the percentage in Python Hacker Rank Solution

### problem

The provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal.

Example
marks key:value pair are

‘alpha’:[20,30,40]

‘beta’:[30,50,70]

query_name = ‘beta’

The query_name is ‘beta’. beta’s average score is (30+50+70)/3=50.0.

Input Format

The first line contains the integer n, the number of students’ records. The next n lines contain the names and marks obtained by a student, each value separated by a space. The final line contains query_name, the name of a student to query.

Constraints

• 2 <= N <= 10
• 0 <= Marks <= 100
• Length of marks arrays = 3

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`

### Finding the percentage in Python Hacker Rank Solution

```if __name__ == '__main__':
n = int(input())
marks = {}
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
scores=sum(scores)/3
marks[name] = scores
a = input()
print('%.2f' % marks[a])```

Disclaimer: The above Problem (Finding the percentage in Python) is generated by Hackerrank but the Solution is Provided by Chase2Learn. This tutorial is only for Educational and Learning purposes. Authority if any of the queries regarding this post or website fill the following contact form thank you.

Sharing Is Caring