Boston Python Workshop 3/Friday/Tutorial: Difference between revisions
Content added Content deleted
imported>Jesstess |
imported>Jesstess |
||
Line 673: | Line 673: | ||
return x + y |
return x + y |
||
</pre> |
</pre> |
||
You can return any Python object: numbers, strings, booleans ... even other functions! |
|||
<b>Step 4: use the function</b> |
|||
Once you define this function, you can use it: |
Once you define this function, you can use it: |
||
Line 681: | Line 685: | ||
</pre> |
</pre> |
||
Functions don't have to return anything, if you don't want them to. |
Functions don't have to return anything, if you don't want them to. They usually return something because we usually want to be able to assign variables to their output. |
||
==End of Part 2== |
==End of Part 2== |