Process the same data in staffSalaryList, now recorded in a dictionary staffSalaryDict with staff number as key
Fantastic news! We've Found the answer you've been seeking!
Question:
(i) Initialise staffSalaryDict using the data in staffSalaryList.
(ii) Determine and print the number of staff number and salary pairs there are in staffSalaryDict.
(iii) Locate the salary of staff with staff number p123. If the staff can be located, update the salary to 3600 and print Updated! If staff cannot be located, print Unable to locate.
(iv) Print the staff number and salary of staff in ascending order of salary and in ascending order of staff number if the salaries tie.
Based on the operations, explain which operations are best suited for the list and which operations are best suited for the dictionary. Use the operations in Q2(b) in your explanation. (4 marks)
Related Book For
Posted Date: