How do you write a function in python 3?



How do you write a function in python 3?..

Answer / Krishnanand Yadav

In Python 3, you can define a function using the `def` keyword. Here's an example: `def my_function(a, b):n c = a + bn return c`. This defines a function named `my_function` that takes two arguments, `a` and `b`, adds them together, and returns the result.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is the use of map in python?

1 Answers  


What are the two modes of python?

1 Answers  


What is a flask?

1 Answers  


Which of the following statements create a dictionary? (Multiple correct answers possible)

1 Answers  


Explain the use of // operator in python?

1 Answers  


What are the possible ways to load an array from a text data file in python? How can the efficiency of the code to load data file be improved?

1 Answers  


What is yaml file in python?

1 Answers  


What is superclass and subclass in python?

1 Answers  


What is the purpose of the pythonpath environment variable?

1 Answers  


What is casting in python?

1 Answers  


What is abc abstractmethod?

1 Answers  


Explain me inheritance in python with an example?

1 Answers  


Categories