-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjune4exercise.py
38 lines (27 loc) · 1.12 KB
/
june4exercise.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
occasions = [
{'id': "38fj8d900", 'city': 'Hamilton', 'events': [{'date': '2017-01-01', 'attendees': 100}, {'date': '2016-12-31', 'attendees': 60}]},
{'id': "39fo837y7", 'city': 'Toronto', 'events': [{'date': '2017-03-30', 'attendees': 3000}, {'date': '2017-07-07', 'attendees': 2500}, {'date': '2017-02-04', 'attendees': 900}]},
{'id': "58uj8d800", 'city': 'Montreal', 'events': [{'date': '2017-08-10', 'attendees': 250}]},
{'id': "48hn8d900", 'city': 'Kingston', 'events': [{'date': '2015-04-16', 'attendees': 45}]}
]
for occasion in occasions:
print(occasion['city'] + '\n' + '------------')
for event in occasion['events']:
print('Date: ' + event['date'] + ', ' + str(event['attendees']) + ' people')
print('\n')
# Write code to display this data in the following format:
# Hamilton
# ------------
# Date: 2017-01-01, 100 people
# Date: 2016-12-31, 60 people
# Toronto
# ------------
# Date: 2017-03-30, 3000 people
# Date: 2017-07-07, 2500 people
# Date: 2017-02-04, 900 people
# Montreal
# ------------
# Date: 2017-08-10, 250 people
# Kingston
# ------------
# Date: 2015-04-16, 45 people