Changes

Jump to: navigation, search

OPS435 Python Lab 3

88 bytes added, 08:15, 2 June 2017
PART 2 - Providing Functions With Arguments
square(12)
square(square(2))
</source>Multiple arguments are separated by '''commas'''. Be careful NOT to provide strings (without using quotes) or using numbers that use decimalsin these examples, as you may cause errors.<br><br>
:#Issue the following to declare the function '''sum_numbers()''':<source>
def sum_numbers(number1, number2):
return int(number1) + int(number2)
</source>'''NOTE:''' Running functions with multiple arguments is the same. When you put a function as a argument of another function, the '''inner-most function will run first''', and the return value will be used as the argument on for the '''outer function'''. For In the example, in this case below, '''sum_numbers(5, 5)''' will return '''10''', and provide thus providing that result to be square with that value '''square( 10 )'''.<br><br>
:#Issue the following to test out passing multiple arguments to the sum_numbers() function:<source>
sum_numbers(5, 10)
13,420
edits

Navigation menu