Skip to playerSkip to main contentSkip to footer
  • 5/20/2025
Default parameters in Python allow functions to have optional arguments with pre-defined values. If a value is not provided for a default parameter during a function call, its default value is used.

Category

📚
Learning
Transcript
00:00We have to ask that you can't do that again.
00:02I will tell you that you can't do it again.
00:04That you can't do it again.
00:06You can't do it.
00:08It's a smile.
00:09That's a smile.
00:11You can't ask.
00:13What happened here?
00:15The thing is that I will have to ask you.
00:18Do you want me to ask you?
00:20I will never know.
00:21You will have to ask.
00:24This is one of the best courses.
00:26I will have to ask you to ask you.
00:29Let's say Define Receipt.
00:32In Receipt, you will need a name.
00:35You will need a amount.
00:37And then you will print the name.
00:39You will need a name with high name.
00:46You will need a amount.
00:49You will need a amount.
00:51And then you will need a amount.
00:55Now you will need a parameter to define.
01:01And you will need a code to give the owner.
01:05The owner has executed this code.
01:08And then you will need a argument.
01:11You will need a name.
01:13Let's say that the name was Johnny.
01:24Johnny and Johnny have 10-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0.
01:30Now, the owner has executed this code.
01:36The bill will print it.
01:40Very good. Excellent.
01:41We have to know that we have two adder functions.
01:46However, there is a small problem.
01:50This is a problem.
01:51Problem is that the owner is not a programmer.
01:56So he said that he said that you could live this 10 or Sally later.
02:05So he did not execute it.
02:07He said it to receive the Электром.
02:08Then he emphasized it.
02:09He said that he reminded me about it.
02:12So you can explain it.
02:14He asked not, because he said that you could explain it.
02:16that this parameter is the positional parameter and this argument is the positional argument
02:25because it is strictly dependent on its location and its position on its location
02:31that the name is always before the name is before the name is before the name is before the name
02:37this is the result of the name amount is before the name is before the name is after the name
02:45this is the problem
02:47this is the positional argument
02:50this is the position which is very important
02:54this is the positional argument
02:57this concept is clear
02:59now we have to declare it
03:02this argument is the positional argument
03:06this is the result of this argument
03:09the second concept is the key word argument
03:23if you have a shopkeeper
03:25about it. I don't know if I'm not a programmer. I'm not a programmer. I'm a easy way to
03:31give it an easy way to give it easy. More declarative way. So you can say that
03:39a concept exists. It's a keyword argument. So if you can understand this function, if
03:46you don't understand it, then you can take it simple. You can take it in a parameter
03:52meter میں میں نے define کیا تھا اور اس کے equal
03:54کر دینا ہے just like that
03:56اب position کا
03:57آپ کو فکر کرنے کی ضرورت نہیں ہے کیونکہ
04:00اب آپ کی دے رہے ہیں
04:01اس parameter کی actually value assign
04:04کر رہے ہیں تو اب چاہے یہ پہلے ہو
04:06یا بعد میں doesn't matter کیونکہ آپ
04:07directly آپ وہ value assign کر رہے ہیں اسی keyword
04:10کو تو اب جو ہی آپ execute کرتے ہیں
04:11اب آپ کی receipt جو ہے
04:13you pay 10 thank you
04:14تو اب آپ کی receipt ٹھیک ہو گی ہے
04:17تو اس کو کہتے ہیں
04:19keyword argument basically
04:21آپ نے اس کو کہا کہ یہ ایک دوسرا طریقہ ہے
04:23وہ ہے keyword argument
04:25کہ اب چاہے آپ ان کی position
04:27reverse بھی کر دیں لیکن
04:29جب آپ صحیح keyword
04:31use کریں گے اور اس کو amount دیں گے
04:34تو وہ اپنی جگہ پہ چلا جائے گا
04:35اپنی original position پہ چلا جائے گا
04:37جیسا کہ آپ نے یہاں پہ دیکھا کہ amount جو تھی
04:40وہ basically second position
04:42پہ آپ نے یہاں پہ define کی
04:43لیکن جب argument میں
04:45value آئی یہ one ہے
04:48یہ two ہے حالانکہ یہ
04:50one ہے یہ two ہے حالانکہ یہ ایسا
04:52الٹ ہونا چاہیے تھا نا کہ name کو پہلے آنا چاہیے تھا
04:54name کو یہاں پہ آنا چاہیے تھا
04:56amount کو یہاں پہ آنا چاہیے تھا
04:57however یہ reverse ہو گئی ساری چیز
04:59ٹھیک ہے یہ ایسے ہو گئی
05:01اب اس چیز
05:02کو آپ نے
05:04کس طریقے سے mitigate کیا
05:06آپ نے کہا یار
05:06keyword argument exist کرتا ہے
05:09آپ جو ہے اس کو
05:10declaratively value دے سکتے ہیں
05:13چیز clear ہو گئی
05:14اب ایک اور میں آپ کو pro tip دینے لگا ہوں
05:17وہ pro tip یہ ہے کہ normal یہ standard practice نہیں ہے
05:20ایک تیسرا
05:21method exist کرتا ہے
05:24اس کو کہتے ہیں
05:24default
05:26default
05:27default value
05:31default value میں آپ یہ کرتے ہیں
05:33بجائے اس کے کہ یہاں پہ
05:35keyword argument دینے پڑیں
05:36آپ directly یہی پہ یہ values assign کر دیتے ہیں
05:39name is equal to
05:40john
05:42ٹھیک ہے اور amount
05:43is equal to 10
05:45ٹھیک ہے تو یہ john کو میں یہاں پہ string میں
05:47close کر دیتا ہوں
05:48string
05:48and amount is 10
05:49اب
05:51اگر میں execute کرتا ہوں
05:52you will not see any difference
05:53ٹھیک ہے
05:55کوئی difference نہیں ہے
05:56however
05:57اگر by mistake
05:59آپ اپنے function کو
06:01نہ کوئی
06:02argument دیتے ہیں
06:04نہ keyword argument دیتے ہیں
06:06اگر اب میں اس کو execute کرتا ہوں
06:07تو what do you expect
06:08جو default values آپ نے دی ہیں
06:11وہ automatically replace ہو جائیں گی
06:12یہاں پہ
06:12i john you pay 10
06:14i john you pay 10
06:15however آپ نے کوئی بھی value نہیں دی ہوئی
06:16یہ value
06:17اس لیے یہاں پہ
06:18automatically آگئی ہے
06:19کہ
06:20already آپ نے
06:21default value دے دی ہوئی ہے
06:22however
06:23جب آپ کوئی نئی value دیتے ہیں
06:24آپ کہتے ہیں
06:25یار
06:25let's say
06:26pinto
06:28pinto
06:30اور pinto paid
06:31let's say 25
06:32اب جب اس کو execute کرتے ہیں
06:34تو pinto basically override کر دے گا
06:36john کو
06:36ٹھیک ہے نا
06:38یہ ہے default value
06:40تو تین چیزیں ہم نے سیکھی
06:41ایک تو ہم نے سیکھا
06:43positional
06:44positional کے spelling میں
06:45غلط لیکھے ہیں
06:45اپنے کیڑے نہیں نکالنے
06:46spelling میں سے
06:47positional
06:48argument
06:50دوسری چیز
06:51argument
06:51دوسری چیز ہم نے سیکھی
06:53keyword argument
06:54تیسری چیز ہم نے سیکھی
06:56default parameters
06:57تو چلیئے
06:58ہم اس کو close کرتے ہیں
06:59موسیقی

Recommended