Skip to main content

Posts

Showing posts with the label Hacker rank python

Hacker rank Python

  if __name__ == '__main__' :     result = []   # Initialize result OUTSIDE the loop     Scorelist = []   # Initialize Scorelist OUTSIDE the loop     for _ in range ( int ( input ())):         name = input ()         score = float ( input ())         result.append([name, score])         Scorelist. append(score) #store the score, not a list containing a score.     b = sorted ( list ( set (Scorelist)))[ 1 ]     for a, c in sorted (result): # sort() does not create a new list, and sorted () created the new list         if c == b:             print (a) answer: input : 3 if __name__ == '__main__' :     n = int ( input ()) # get the value in runtime and convert it into an int     for i in range ( 1 ,n+ 1 ): # range always starts from 0 and ends with n-1 in order to sta...