Created
June 27, 2016 15:48
-
-
Save libert-xyz/c7e900e8bebd4f4f9c1a7b954f25b9fe to your computer and use it in GitHub Desktop.
Finding the percentage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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