I am on pset 2 problem 4. I am struggling with the use of a tuple. Why must I bind 'packages' to a tuple? Why can't I just have the user enter in values for x, y, and z seperately and just solve it from there. Code: http://codepad.org/EQ92qLbW
is this code sufficient for this assignment? Or am I not understanding the question: http://codepad.org/FJl0rOhC
All this means is that your program needs to accept input in the form of a tuple. So if the variable "packages" is a tuple with the format (x, y, z), you can set x with: x = packages[0] to access the first element of the tuple, then: y = packages[1] etc. This is useful because as your code gets more complex it is much easier to work with structured data than a ton of variables.
Thanks!
Join our real-time social learning platform and learn together with your friends!