Table of Contents
Python Tutorial
Table of Contents
Python Tutorial
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
*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
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 करे,
- 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

Table of Contents All Chapters 1. Personal Area Network 2. Local Area Network 3. Campus Area Network 4. Metropolitan Area...

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

Table of Contents All Chapters 1. Special Logic Gate 2. XOR Gate 2.1. XOR Gate Truth Table 3....

Table of Contents All Chapters 1. Universal Logic Gates 2. NOR Gate 2.1. NOR Gate Truth Table 3....

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

Table of Contents All Chapters 1. Simplification 2. Simplification using Boolean Algebra Theorems 3. Simplification using K-map Digital Electronics...

Table of Contents All Chapters 1. Identity Laws 2. Null Laws 3. Domination Laws 4. Idempotent Laws 5. Complement Laws...