Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created June 27, 2016 15:48
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 libert-xyz/c7e900e8bebd4f4f9c1a7b954f25b9fe to your computer and use it in GitHub Desktop.
Save libert-xyz/c7e900e8bebd4f4f9c1a7b954f25b9fe to your computer and use it in GitHub Desktop.
Finding the percentage
#Finding the percentage
#6/27/16
#https://www.hackerrank.com/challenges/finding-the-percentage
avg = {}
number = input(('Number of students: '))
for i in range(number):
name_marks = raw_input(str('Name and Marks: '))
marks = (
(float(name_marks.split(" ")[1])) +
(float(name_marks.split(" ")[2])) +
(float(name_marks.split(" ")[3]))
) // 3
avg[name_marks.split(" ")[0]] = "%0.2f" % marks
name_avg = raw_input('Name Average: ')
if name_avg in avg:
print avg[name_avg]
else:
print 'No Name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment