Pagina de 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

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

Solución

avatar
Celinamaestro · Tutor durante 5 años
expert verifiedVerificación de expertos
4.2 (209 votos)

Responder

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:<br /><br />```python<br />def function_name(parameters):<br /> # function body<br /> return [expression]<br />```<br /><br />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.
Haz clic para calificar: