Hacker Rank Set.add()
This is simple problem where we just need to take size of our set as n and country names using input()
and loop it this just simple naive approach you can do more better
and remember whenever in python take user argument or input through looping the any collection liek list and set here use underscore as argument taker ' _ ' as below code mentioned otherwise you got unknown unicode.
Problem: https://www.hackerrank.com/challenges/py-set-add/problem
Code:
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
country = set()
def set_add():
for _ in range(n):
country.add(input())
return len(country)
print(set_add())
Time: Big(O)n
Comment your solution as well!
