Answer to Question #235945 in Python for akshita

Question #235945

Apply your knowledge of the .add() operation to help your friend Rupal.


Rupal has a huge collection of country stamps. She decided to count the total number of distinct country stamps in her collection. She asked for your help. You pick the stamps one by one from a stack of N  country stamps.


Find the total number of distinct country stamps.

The first line contains an integer N , the total number of country stamps.

The next N  lines contains the name of the country where the stamp is from.

Sample Input

7
UK
China
USA
France
New Zealand
UK
France 

Sample Output

5

Explanation

UK and France repeat twice. Hence, the total number of distinct country stamps is  5(five).


1
Expert's answer
2021-09-13T03:48:01-0400
countries = {input() for _ in range(int(input()))}
print(len(countries))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS