Python Training for Power Systems Engineers
For each of the following examples write down the answer you expect to see Python output.
{'name': 'NUC1', 'age': 23}['age']{'name': 'NUC1'}.get('age', 5)case = {'filename': 'case-01.sav', 'year': 2019, 'scenario': 'light'}
case['filename']case = {}
case['year'] = 2020
case['scenario'] = 'peak'
case['year']case = {}
case['year'] = 2020
case['scenario'] = 'peak'
case.get('year', 2030)pairs = [('fuel', 'Wind'), ('capacity', 200), ('make', 'Vestas')]
station = dict(pairs)
station['fuel']pairs = [('fuel', 'Wind'), ('capacity', 200), ('make', 'Vestas')]
station = dict(pairs)
pairs[1]