Finding the percentage Hackerrank Solution Python
For Explanation Watch Video:
Sample Input 0
3
Krishna 67 68 69
Arjun 70 98 63
Malika 52 56 60
Malika
Sample Output 0
56.00
Code:
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() arr = student_marks[query_name] #25 26.5 28 sum = 0 for i in arr: sum += i res = sum / len(arr) print("%.2f"%res)
Comments
Post a Comment