Function Parameters in Python

You can pass parameters to a function in parentheses. Let's look at an example.

Let's make a function that will take two numbers as parameters and output the sum of these numbers to the console. of this number. To do this, in parentheses, separated by commas, we will write the names of the variables that will receive the parameters. The names of these variables can be anything. Let's call them, for example, num1 and num2. We will immediately find the sum of the transferred numbers:

pythondef func(num1, num2):
  print(num1 + num2)

Let's now call our function, passing it some numbers as parameters:

pythonfunc(2, 3) # 5
Задание 1

Make a function that takes a number as a parameter and outputs the square of that number.

Задание 2

Create a function that takes two numbers as parameters and outputs their product.

Задание 3

Make a function that takes a number as a parameter and checks whether it is even or not.

Задание 4

Make a function that takes a list of numbers as a parameter and returns the sum of the squares of the list elements.