function
function का उपयोग किसी विशिष्ट कार्य को करने के लिए किया जाता है | function को def keyword से create किया जाता है | एक function input(parameters) ले सकता है | उसे process भी कर सकता है |
Simple function
🐍 Syntax
def example():
print("Hello , Python")
example()
Output
Hello , Python
function with arrgument
🐍 Syntax
def example(name):
print("What is you name")
example(shubham)
Output
shubham
function with return value
🐍 Syntax
def sub(a , b):
return(a - b)
res = sub(15 , 5)
print("The substraction of a and b is :" res)
Output
10