Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

What is python function?

Description

To see what is python function, syntax and example.

Process
Definition of function
      • Function blocks begin with the keyword def.
      • Followed by the function name and parentheses ().
      • The code block within every function starts with a colon (:) and is indented.
      • Any input parameters or arguments should be placed within these parentheses.
Syntax.
    • We can also define parameters inside these parentheses.
    • def functionname( arguments ):
Code block
  • Return statement
Function call statement.
  • To call the function by passing the arguments to the function.
  • We can also call a function using by pass referen
Sample Code

#python function
def sum(a,b):
c=a+b
if(a==b):
print(c+2)
else:
print(c)
print(“****First execution*****”)

#calling the function
sum(5,6)

#calling by reference
input1=5
input2=5
print(“****Second execution*****”)
sum(input1,input2)

Screenshots
What is python function