Set .add() Hackerrank Solution Python Code:: n = int ( input ()) #for Number of country s = set () for i in range (n): s.add( input ()) #input from user print ( len (s)) #length of set
Introduction to Sets Hackerrank Solution Python code:: def average(array): # your code goes here s = set () for i in array: s.add(i) return sum (s)/ len (s) if __name__ == '__main__' : n = int ( input ()) arr = list ( map ( int , input ().split())) result = average(arr) print (result)