Skip to content

Instantly share code, notes, and snippets.

@FeezyHendrix
Created August 24, 2020 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FeezyHendrix/df347bbcaf479d28796183b6732b4e55 to your computer and use it in GitHub Desktop.
Save FeezyHendrix/df347bbcaf479d28796183b6732b4e55 to your computer and use it in GitHub Desktop.
Find the Percentage Hackerrank
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()
percentage = 0
sum = 0
count = 0
for i in student_marks[query_name]:
sum += i
count += 1
percentage = sum / count
print("{0:.2f}".format(percentage))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment