Unpacking Arguments
Today we will create a function which will calculate the health of a person.
Here is the code -
def health_calculator (age, apples_ate, cigr_smoked)
answer = (100-age)+(apples_ate*3.5)-(cigr_smoked*2)
print (answer)
my_data = [27, 20, 0]
health_calculator (my_data[0], my_data[1], my_data[2])
health_calculator (*my_data)
Other posts -
No comments:
Post a Comment