How do I include a first function (with a specific parameter) to a econd function (with a different specific parameter)?

On first glance, I know the following code looks incorrect.

Example A

def one_good_turn(n):
  return n + 1
def deserves_another(m):
  return one_good_turn(n) + 2

Here is the link for reference:
example function within a function’

In the actual example before hand, the python coure suggested doing the following:

Functions Calling Functions
We’ve seen functions that can print text or do simple arithmetic, but functions can be much more powerful than that. For example, a function can call another function:

def fun_one(n):
  return n * 5

def fun_two(m):
  return fun_one(m) + 7

My specific problem is that I want to use a different letter for the parameter than the first function.

So looking at example A,

I want def deserve another to have a different parameter name than def one good turn

How would I do that?

Try the following:

def one_good_turn(n):
return n + 1

def deserves_another(m):
return one_good_turn(n=m) + 2

As you are using different letters, you need to define them. I tested it and it works for me.
Hope this helps.

Is this how I add four to a parameter I call through the function:

def one_good_turn(n):
  return n + 4

In the example you have given if you pass 4 through it, it will return 8 (4+4).

What Im trying to do, for example, is have a list of sandwiches, and then the tax. From time to time the sandwich list will change, but I want to have shortcuts to the BLT, meatball, and ham and cheese (HandC)


so I could do something like

HaC= 2.00
tax = 0.25
def sandwich:
    sandwich + tax

The psuedocode associated with thi i you can choose sandwich 1, 2, or 3.
How do I refer to these sandwiches without equating the variable to 3 permanently?

Here I have defined the variable before, so I’m not asking the computer to guess what I’m thinking.

sounds like you should be using a dictionary