Set .add()

Sort by

recency

|

957 Discussions

|

  • + 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}")
    
  • + 0 comments

    n=int(input()) countries=set() for i in range(n): name=input() countries.add(name) print(len(countries))

  • + 0 comments

    n=int(input()) se=set() for i in range(n): se.add(input())

    print(len(se))

  • + 0 comments

    country_size=int(input()) country_set=set() for _ in range(country_size): country_name=input() country_set.add(country_name) print(len(country_set))

  • + 0 comments

    country_size=int(input()) country_set=set() for _ in range(country_size): country_name=input() country_set.add(country_name) print(len(country_set))