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

Hi, so i've got a bit of a general question about abstractions, if i put "return best_value" as the conclusion for instance, go i now have the global variable 'best_value' available? Otherwise, do i need to say, def get_best_value() newVariable = get_best_value() In order to link the output to a variable? I'm working on pset6 at the moment, and with all those definitions flying around i've found myself a little confused. Thanks.

OpenStudy (anonymous):

http://pastebin.com/hb4bQGyL

OpenStudy (siberman):

Hey, thanks for that, so this leads to the further question, what if a function has multiple outputs? Is it necessary to us the function to populate a list?

OpenStudy (anonymous):

there is only one return statement. if you want to return more than one thing you can put them in a list or a dictionary or a tuple. you can return any type of object. http://dpaste.com/711361/

OpenStudy (siberman):

That's what i thought, i guess returning a dictionary with meaningful keys would be a good way to go. Thanks for the clarification,

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!
Latest Questions
Breathless: Spooky witch but cute
6 hours ago 3 Replies 0 Medals
Arriyanalol: help
6 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
9 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
9 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
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!