1students = [
2 {
3 'name': 'Sarah',
4 'city': 'Manchester'
5 },
6 {
7 'name': 'Mary',
8 'city': 'London'
9 }
10 ,
11 {
12 'name': 'Charlotte',
13 'city': 'Paris'
14 },
15 {
16 'name': 'Carl',
17 'city': 'Paris'
18 }
19]
20
21
22
23my_location = input('Which is your location? ')
24match_location = [student for student in students if student['city'] == my_location]
25
26
27# Option 1
28if len(match_location) > 0:
29 print('The location is:')
30
31
32# Option 2
33if any(match_location):
34 print('The location is:')