Featured post

Best Machine Learning Book for Beginners

You need a mixof different technologies for Data Science projects. Instead of learning many skills, just learn a few. The four main steps of any project are extracting the data, model development, artificial intelligence, and presentation. Attending interviews with many skills is not so easy. So keep the skills short.
A person with many skills can't perform all the work. You had better learn a few skills like Python, MATLAB, Tableau, and RDBMS. So that you can get a job quickly in the data-science project.
Out of Data Science skills, Machine learning is a new concept. Why because you can learn Python, like any other language. Tableau also the same. Here is the area that needs your 60% effort is Machine learning.  Machine Learning best book to start.

Related Posts How to write multiple IF-conditions in Python Simplified

Understanding Python Function Quickly

In Python, you can define and call the function. Once you define the function, you can call it later from the other program. I have shared the structure of the function. And, I have added the three key rules of Python function; useful for interviews.

🔑Three Key rules.

  1. A function definition is executable.
  2. The function body will be executed only when it is called.
  3. you can assign default parameter value for a function.

Structure of the Python Function.


How to Understand Python Function Quickly
 Understanding Python Function Quickly  


1. Key Elements.

You will find here three key elements of the Python function. Here you can read the parameter vs argument differences.

Dream higher

  • Name of a functionThe name of a function is any valid identifier. It should be noted though that the name of a function should be meaningful and, if possible, convey the task to be performed by the function.
  • Parameter. The list of parameters (separated by commas) is given in the parentheses following the name of the function. The parameters are basically the input to the function. A function may have any parameters.
  • Body of the function. The body of the function contains the code that implements the task to be performed by the function.


2. Sample Function.

Life shrinks or expands in proportion to one’s courage

đź””Python Example.

def product(num1, num2): 
# defined function name of product with two input parameters. 
# And this 'def' ends with ':' colon.

prod= num1*num2 
# multiplying two numbers num1 and num2 and assign to prod

print('The product of the numbers is \t:'+str(prod))
# prints product of two numbers

num1=int(input('Enter the first number\t:')) 
num2=int(input('Enter the second number\t:'))
return prod
# returns prod value to the calling program.

3. How to call a function.

Relax

myproduct = product(num1, num2)
# supply two arguments to the product function.

print(myproduct)
#The product function prints the product of two numbers.


References

Comments

Popular posts from this blog

Hyperledger Fabric: 20 Real Interview Questions

Best Machine Learning Book for Beginners

Python Assigning Multiple Values at Once