Passing Parameters and Variable Scopes: What Is Main - The Conductor
Passing Parameters and Variable Scopes: What Is Main - The Conductor
Scopes
2015-11-30
Default Arguments
A default argument is an argument that can be optionally provided
Def mortgage_rate(amount,rate,term = 20)
Monthly_payment = mortgage_rate(35000, 0.06)
Parameter term is assigned to default value 20 thus optionally provided when
calling function
Quick Question
Def Try_this(a, b=5, c=10):
Return a + b + c
Def main():
Print(Try_this(5, c = 5)
Output = 15
Def SumPos(nums)
For k in range(0, len(nums)):
If nums[k] < 0:
Return sum(nums)
Actual argument nums_1 has been altered, with all negative values set to 0.
Immutable
Mutable
Numeric types
Lists
Boolean type
String type
Tuples
Writing a Function the design process
Importance of design
-