Skip to content

fevzitopcu/PythonFundementals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Questions

Q: What is function in Python? A: A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.

Tips: In fact, according to relevant Python documents, there is no significant difference between the definition and use of parameter and argument terms in Python. But, they are slightly different from each other.

From a function's perspective:

A parameter is the variable listed inside the parentheses in the function definition. deffunction(a, b) An argument is the value that is sent to the function when it is called. function(2, 3)


Q: Explain Python functions. A: A function is a section of the program or a block of code that is written once and can be executed whenever required in the program. A function is a block of self-contained statements which has a valid name, parameters list, and body. Functions make programming more functional and modular to perform modular tasks. Python provides several built-in functions to complete tasks and also allows a user to create new functions as well. There are two types of functions: Built-In Functions: copy(), len(), count() are the some built-in functions. User-defined Functions: Functions which are defined by a user known as user-defined functions.



Q: How do we write a function in Python? A: We can create a Python function in the following manner.

Step-1: to begin the function, start writing with the keyword def and then mention the function name. Step-2: We can now pass the arguments and enclose them using the parentheses. A colon, in the end, marks the end of the function header. Step-3: After pressing an enter, we can add the desired Python statements for execution.



Q: What is the return keyword used for in Python? A: The purpose of a function is to receive the inputs and return some output. The return is a Python statement which we can use in a function for sending a value back to its caller.







About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published