I cant understand what is it even asking me, why is it this complicated?

Recently I’ve started to learn python, I don’t have any background and I am totally new to it.

The first lessons very pretty easy to pick up, but with the number rising, I find the course to be quite complicated to pick up. At some point, I saw a function with called customer_greetcustomer_customer can I have the smallest idea, why would they have to make it this complicated, when they could easily and simply call it greetcustomer.

Anyways, I am stuck here: https://www.codecademy.com/courses/learn-python-3/lessons/intro-to-functions/exercises/returns

def calculate_age(current_year, birth_year):
  age = current_year - birth_year

I kinda get it, but I have no freaking idea what it is asking me to do with:

The function **calculate_age** in **script.py** creates a variable called **age** that is the difference between the current year, and a birth year, both of which are inputs of the function. Add a line to return **age**.

What exactly it is asking me to do when saying Add a line to return age. Why cant they write it in a more simpler way to pick it up.

I would appreciate if someone, could explain what exactly are they saying with that, in a simpler way?

Hello @py6023654760, welcome to the forums! The code you currently have is correct, except you are missing the return statement. This basically just returns data to the program, and this allows you to store the data in variables, etc.
See below:

def a_function():
    return 5

You can now store this data in a variable:

some_var = a_function()

The value of some_var is now 5, because that was the data returned by the function.

I hope this helps!


Hello, thank you for the qucik answer.

Now it makes sense, I really could not get what it meant with “add a line…”.

So now, when I do this, it works.

def calculate_age(current_year, birth_year):
  age = current_year - birth_year
  return age

Can’t believe it was that simple.