To create a function that calculates the total cost of apples based on the number of pounds, we can use the given price of $1.25 per pound.
The function f
can be defined as follows:
def f(x):
return 1.25 * x
In this function:
x
represents the number of pounds of apples.- The function multiplies the number of pounds
x
by the price per pound ($1.25) to calculate the total cost.
You can use this function by passing the number of pounds as an argument to f
. For example, f(2)
would return the total cost for 2 pounds of apples, which would be $2.50.