+ 6

How does the "return" function work in python 3? ._.

I am beging to code so some of these functions don't click yet. But I would love to learn how they do! Thank you!

5th Feb 2017, 11:28 PM
PaperGami T.
PaperGami T. - avatar
6 ответов
+ 3
return is simple def add(x,z): a=x b=z c=a+b return c if I call add(2,3) it will return c.. which is 5
5th Feb 2017, 11:30 PM
LordHill
LordHill - avatar
+ 5
OMG. It all clicks now!! Thank you!!!! ^^
6th Feb 2017, 12:00 AM
PaperGami T.
PaperGami T. - avatar
+ 2
does that make sense?
5th Feb 2017, 11:30 PM
LordHill
LordHill - avatar
+ 2
So that means I would then disclose a and B because they aren't being returned to the 'add'?
5th Feb 2017, 11:32 PM
PaperGami T.
PaperGami T. - avatar
+ 2
well that would be up to you, the variables are just an example.. you can return anything. here is another def shout(): return print("ahhhhh!") shout() return is whatever information you want to get back from your function
5th Feb 2017, 11:35 PM
LordHill
LordHill - avatar
+ 1
It's a great feeling when things click.. functions are fun.. if you haven't played with for loops, I would go there next. very useful
6th Feb 2017, 12:01 AM
LordHill
LordHill - avatar