#!/usr/bin/env python3 #Tuples Examples # create a dictionary squares = {1:1, 2:4, 3:9, 4:16, 5:25} # dictionary with integer keys AfNOG = {2015:'Tunis',2016:'Gaborone',2017:'Nairobi',2018:'Dakar',2019:'Kampala'} # dictionary with mixed keys my_dict = {'name': 'Ike', 1: [2, 4, 3]} # using dict() function afnog_dict = dict({2015:'Tunis',2016:'Gaborone',2017:'Nairobi',2018:'Dakar'}) # from sequence having each item as a pair ais_dict = dict([(2017,'Nairobi'),(2018,'Dakar'),(2019,'Kampala')]) # Outputing Dictionary print('Name:', my_dict['name']) print('Ais City in 2018:', ais_dict.get(2018)) # update dictionary value my_dict['name'] = 'Esi' print('my_dict',my_dict) # add item to dictionary afnog_dict[2019] = 'Kampala' print('AfNOG year and city:',afnog_dict)