Inicio
/
Tecnología
/
What Keyword Is Used to Define a Function in Python? Def Create Method Function

Problemas

What keyword is used to define a function in Python? def create method function

Roztwór

Celina maestro · Tutor durante 5 años
Weryfikacja ekspertów
4.2 (209 Votos)

Respuesta

The correct answer is "def". In Python, the keyword "def" is used to define a function. The syntax for defining a function in Python is as follows:```pythondef function_name(parameters): # function body return [expression]```Here, "function_name" is the name of the function, "parameters" are the input parameters, and the "function body" contains the code that will be executed when the function is called. The "return" statement is used to return a value from the function.