Important Notice:

Positional Arguments

Positional Arguments

24 views 1 min read

Positional Arguments :-

Hindi: Positional Arguments वे arguments होते हैं जिनकी values का मिलान function के parameters के साथ उनके क्रम (Position) के आधार पर होता है।

English: Positional arguments are arguments matched with function parameters according to their order or position.

Example:

def student(name, age):
    print("Name:", name)
    print("Age:", age)

student("Rahul", 18)

Output:

Name: Rahul
Age: 18

Explanation:

  • "Rahul" पहले parameter name को मिलता है।

  • 18 दूसरे parameter age को मिलता है।

Important: Positional arguments देते समय क्रम बदलने पर values का मिलान भी बदल सकता है।

student(18, "Rahul")

इस call में name को 18 और age को "Rahul" मिलेगा। Python अपने आप इन values के अर्थ के अनुसार क्रम नहीं बदलता।

Related Notes