How to Create Function in Python

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

def display():
    print("Welcome in python function")

def addition():
      a=int(input("Enter first number"))
      b=int(input("Enter second number"))
      c=a+b
      print("Addition is : ",c)

def sub():
      a=int(input("Enter first number"))
      b=int(input("Enter second number"))
      c=a-b
      print("Addition is : ",c)

def grater():
      a=int(input("Enter first number"))
      b=int(input("Enter second number"))
      print("Grater Number is : ",a) if(a>b) else print("Grater Number is : ",b)
      






# Programmer
# print("start")
# display()
# print("End")

Program 2

import dataflair as d

#d.addition()
d.grater()

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply