Parameters and Arguments in Hindi

What is Parameters and Arguments in Function

किसी Function मे अगर हमे कोई value या data देना होता है तो हम Parameters और Arguments का use करते है।

What is Function Parameters

function को define करते समय function name मे parentheses के अंदर हम जो variable देते है उन्हे parameters कहा जाता है। Parameters को Formal Arguments भी कहा जाता है। 

SYNTEX

# Creating Function
def function_name(Parameter):
       # Function body

*args

अगर हम parameter मे variables के आगे “ * “ का use करे तो, अब ये parameter एक mutable object (list, set, tuple) को लेगा। but आम-तौर पर हम किसी variable के आगे ” * ” नहीं लगाते बल्कि ” *args  ” नाम का parameter create करते है। 

**kwargs

अगर हम parameter मे variables के आगे “ ** “ का use करे तो, अब ये parameter एक dictionary को लेगा। but आम-तौर पर हम किसी variable के आगे ” ** ” नहीं लगाते बल्कि ” **kwargs  ” नाम का parameter create करते है। 

What is Function Arguments

function को call करते समय function name मे parentheses के अंदर हम जो भी value देते है उन्हे arguments कहा जाता है। हम जिस function मे arguments देंगे वो उस function के parameters मे assign हो जाएगा। Arguments को Actual Arguments भी कहा जाता है। 

SYNTEX

# Calling Function
print(function_name(Arguments))

Types of Arguments

Positional Arguments

अगर हम किसी function को call करते समय arguments को order (position) के basis पर pass करते है तो इसे position arguments कहते है।

Positional argument में order matter करता है मतलब अगर हम function calling के समय “24” & “jay” arguments pass करते है तो “24” first number पर है तो ये function के first parameter में जाएगा इसी तरह “jay” second parameter में जाएगा, आम-तौर पर हम इसी type से arguments को pass करते है।

Keyword Arguments

अगर हम किसी function को call करते समय arguments को parameter के name के साथ pass करते है तो इसे Keyword Argument कहते है।

Keyword argument में order matter नहीं है for example किसी function में “student” नाम का parameter पहले है और “age” नाम का parameter दूसरे number पर है, और हमने function calling के समय पहले “age” parameter को initialize करके pass किया फिर “student” को तो भी “student” में student का name जाएगा और “age” में उसका age जाएगा।

Default Arguments

अगर हम function parameter मे ही value को assign कर दे तो इसे default parameter value या default agruments कहा जाएगा। अब हम function को call करते समय arguments न दे तो भी हमारा function work करेगा , but अगर हमने argument दे दिया तो ये default parameter value को overwrite कर देगा 

Mutable Default Arguments

अगर हम किसी function के parameter का default value में एक mutable object (list, set, dictionary, etc.) को देते है तो इसे mutable default argument कहते है।

But इसमे एक दिक्कत होता है, जैसे हमने किसी empty list को default argument में दिया तो program में जब ये function execute होगा तो ये empty list create हो जाएगा और अगर इस list में कोई item append होता है तो ये item हमेशा के लिए इस list में आ जाएगा, अगर हम चाहते है की उस function में हमे वो empty list मिले तो ये possible नहीं है इसलिए इस list में directly किसी item को add करने के बजाय हमे condition को use करना चाहिए।

Function as Parameters and Arguments

Python में function भी एक object होता है, इसीलिए हम किसी function को किसी दूसरे function के parameter में argument के रूप में pass कर सकते है।

उम्मीद करते है कि आपको function मे parameters और arguments क्या होता है ये अच्छे समझ मे आ गया होगा। अपने learning को continue रखने के लिए next button पर click करे,

Add a comment...

  • All Posts
  • Artificial Intelligence
  • Computer Fundamentals
  • Computer Networks
  • Data Analytics
  • Data Science
  • DBMS
  • Deep Learning
  • Digital Electronics
  • DSA with Python
  • Excel
  • Exercise
  • Git & Github
  • Machine Learning
  • Matplotlib
  • Natural Language Processing
  • NumPy
  • Operating System
  • Pandas-s
  • Power BI
  • Python Tutorial
  • Scikit-learn
  • Seaborn
  • SQL & MySQL
computer networks

Table of Contents All Chapters 1. OSI Model      1.1. Physical Layer      1.2. Data Link Layer  ...

computer networks

Table of Contents All Chapters 1. Topology 2. Types of Topology      2.1. Point to Point Topology    ...

computer networks

Table of Contents All Chapters 1. Data Communication 2. Types of Data Communication      2.1. Simplex      2.2....

digital electronics number system

Table of Contents All Chapters 1. Logic Gate 2. AND Gate      2.1. AND Gate Truth Table 3. OR...

Edit Template

Sign up to track your learning

Login to continue your learning tracking

To reset your password, please enter your email address or username below.

Scroll to Top