Task 1 & 2
Function | Will Return | Params |
---|---|---|
Take someone's date of birth and return out old the person is in years | Yes Age | DOB |
Look at a price of an item return the cost after a given discount | Yes Cost | None/Price |
Organise some data and insert it into a database | No | None/Data |
Play a tune and display the score when a player completes a level in a game | No | None/Tune |
Check whether and email address is formatted correctly and return the value True if it is | Yes Is Formatted Correctly | None/Email |
Task 3
A: 2
B: number_sides
& side_length
C: 5
& 3.5
D: calc_shape_area
E: sides
& length
Task 4
A: A paramater is passed to a function whereas a variable it restricted to being used in its own scope
B: An argument is defined as a variable that must be passed into a function (some languages except this rule, e.g. Javascript, Python)
C: A return value is a variable that is returned from a function