Set .add()

  • + 0 comments
    def get_distinct_country_stamp(N, countries):
        country_set = set()  
        for country in countries:  
            country_set.add(country)  
        return len(country_set)  
        
    N = int(input().strip())
    countries = [input().strip() for i in range(N)]
    
    count = get_distinct_country_stamp(N, countries)
    print(f"{count}")