Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 7 Online
OpenStudy (anonymous):

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

OpenStudy (anonymous):

is this code sufficient for this assignment? Or am I not understanding the question: http://codepad.org/FJl0rOhC

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

Thanks!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!