Respuesta :
Answer:
Explanation:
We have the following
t is the number of test cases.
n is the number of trips for each testcase
name is the name of the city
all the unique names are added to the list and at last the length of the list is printed.
The program is written as follows
t = int(input) - for i in range(t): n = int(input) 1 = [] for j in range(n): name = input if name not in l: 1.append(name) pr
t = int(input())
for i in range(t):
n = int(input())
l = []
for j in range(n):
name = input()
if name not in l:
l.append(name)
print(len(l))
Output:
The program illustrates the use of lists.
Lists in Python are used to store several values on one variable.
The program written in Python where comments are used to explain each line is as follows
#This gets input for the number of test cases
T = int(input())
#This iterates through the test cases
for i in range(T):
#This gets input for n; the number of work trips
n = int(input())
#This creates a list of the cities visited
city = []
#This iterates through the work trips
for j in range(n):
#This gets the name of the city
name = input()
#For names not in the list of city
if name not in city:
#The city is appended to the city list
city.append(name)
#This prints the number of cities
print(len(city))
Read more about Python lists at:
https://brainly.com/question/24941798