What is function?

When we talk about function, it's typically a series of instruction which in a box and when you put variables in, it will return some certain result.

For example:

def add(a, b):
    return a + b

It's the same thing as f(a,b)=a+bf(a, b) = a + b , which get variables a and b and return a + b.

But in math, we call the a + b y.

毫不夸张地说,老师一直以来都欺骗了我们,把它变得非常神秘。 事实上,函数就是 a function. A function 就是一系列“代码”用来实现一个特定的任务。(比如计算平方、计算数的变化)

Last updated