Thank you MIT for OCW and Open Study ;-) In problemset 3, problem 4 you are supposed to return a tuple. Does using a list instead making any difference?
You could make it work with any collection data structure. But in school, you fail the assignment if you don't follow the instructions. In real life, it depends entirely on your boss' mood when you fail to follow the specifications or meet the requirements. Hang on. A return value? Of course it matters! This code may be used by thousands of other modules someday. And they will all be built expecting a tuple to be returned. The disasterous effects and side effects could be unimaginably devastating! Do you really want to take that chance? You sleep with a gun under your pillow, and sleepwalk, don't you?
nothing stopping you from working with a list inside the function then turning it into a tuple when you return it http://pastebin.com/2XKSgsk5
Think of a function as a contract between your module and the outside world. You are given what the contract should receive and send back. What happens within your module is pretty much your business.
These answers are very useful.
Join our real-time social learning platform and learn together with your friends!