Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Lecture 63: Learn Default Parameter in Python
Nafees AI Lab
Follow
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
Display full video transcript
00:00
We have to ask that you can't do that again.
00:02
I will tell you that you can't do it again.
00:04
That you can't do it again.
00:06
You can't do it.
00:08
It's a smile.
00:09
That's a smile.
00:11
You can't ask.
00:13
What happened here?
00:15
The thing is that I will have to ask you.
00:18
Do you want me to ask you?
00:20
I will never know.
00:21
You will have to ask.
00:24
This is one of the best courses.
00:26
I will have to ask you to ask you.
00:29
Let's say Define Receipt.
00:32
In Receipt, you will need a name.
00:35
You will need a amount.
00:37
And then you will print the name.
00:39
You will need a name with high name.
00:46
You will need a amount.
00:49
You will need a amount.
00:51
And then you will need a amount.
00:55
Now you will need a parameter to define.
01:01
And you will need a code to give the owner.
01:05
The owner has executed this code.
01:08
And then you will need a argument.
01:11
You will need a name.
01:13
Let's say that the name was Johnny.
01:24
Johnny 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:30
Now, the owner has executed this code.
01:36
The bill will print it.
01:40
Very good. Excellent.
01:41
We have to know that we have two adder functions.
01:46
However, there is a small problem.
01:50
This is a problem.
01:51
Problem is that the owner is not a programmer.
01:56
So he said that he said that you could live this 10 or Sally later.
02:05
So he did not execute it.
02:07
He said it to receive the Электром.
02:08
Then he emphasized it.
02:09
He said that he reminded me about it.
02:12
So you can explain it.
02:14
He asked not, because he said that you could explain it.
02:16
that this parameter is the positional parameter and this argument is the positional argument
02:25
because it is strictly dependent on its location and its position on its location
02:31
that the name is always before the name is before the name is before the name is before the name
02:37
this is the result of the name amount is before the name is before the name is after the name
02:45
this is the problem
02:47
this is the positional argument
02:50
this is the position which is very important
02:54
this is the positional argument
02:57
this concept is clear
02:59
now we have to declare it
03:02
this argument is the positional argument
03:06
this is the result of this argument
03:09
the second concept is the key word argument
03:23
if you have a shopkeeper
03:25
about it. I don't know if I'm not a programmer. I'm not a programmer. I'm a easy way to
03:31
give it an easy way to give it easy. More declarative way. So you can say that
03:39
a concept exists. It's a keyword argument. So if you can understand this function, if
03:46
you don't understand it, then you can take it simple. You can take it in a parameter
03:52
meter میں میں نے 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:07
directly آپ وہ value assign کر رہے ہیں اسی keyword
04:10
کو تو اب جو ہی آپ execute کرتے ہیں
04:11
اب آپ کی receipt جو ہے
04:13
you pay 10 thank you
04:14
تو اب آپ کی receipt ٹھیک ہو گی ہے
04:17
تو اس کو کہتے ہیں
04:19
keyword argument basically
04:21
آپ نے اس کو کہا کہ یہ ایک دوسرا طریقہ ہے
04:23
وہ ہے keyword argument
04:25
کہ اب چاہے آپ ان کی position
04:27
reverse بھی کر دیں لیکن
04:29
جب آپ صحیح keyword
04:31
use کریں گے اور اس کو amount دیں گے
04:34
تو وہ اپنی جگہ پہ چلا جائے گا
04:35
اپنی original position پہ چلا جائے گا
04:37
جیسا کہ آپ نے یہاں پہ دیکھا کہ amount جو تھی
04:40
وہ basically second position
04:42
پہ آپ نے یہاں پہ define کی
04:43
لیکن جب argument میں
04:45
value آئی یہ one ہے
04:48
یہ two ہے حالانکہ یہ
04:50
one ہے یہ two ہے حالانکہ یہ ایسا
04:52
الٹ ہونا چاہیے تھا نا کہ name کو پہلے آنا چاہیے تھا
04:54
name کو یہاں پہ آنا چاہیے تھا
04:56
amount کو یہاں پہ آنا چاہیے تھا
04:57
however یہ reverse ہو گئی ساری چیز
04:59
ٹھیک ہے یہ ایسے ہو گئی
05:01
اب اس چیز
05:02
کو آپ نے
05:04
کس طریقے سے mitigate کیا
05:06
آپ نے کہا یار
05:06
keyword argument exist کرتا ہے
05:09
آپ جو ہے اس کو
05:10
declaratively value دے سکتے ہیں
05:13
چیز clear ہو گئی
05:14
اب ایک اور میں آپ کو pro tip دینے لگا ہوں
05:17
وہ pro tip یہ ہے کہ normal یہ standard practice نہیں ہے
05:20
ایک تیسرا
05:21
method exist کرتا ہے
05:24
اس کو کہتے ہیں
05:24
default
05:26
default
05:27
default value
05:31
default value میں آپ یہ کرتے ہیں
05:33
بجائے اس کے کہ یہاں پہ
05:35
keyword argument دینے پڑیں
05:36
آپ directly یہی پہ یہ values assign کر دیتے ہیں
05:39
name is equal to
05:40
john
05:42
ٹھیک ہے اور amount
05:43
is equal to 10
05:45
ٹھیک ہے تو یہ john کو میں یہاں پہ string میں
05:47
close کر دیتا ہوں
05:48
string
05:48
and amount is 10
05:49
اب
05:51
اگر میں execute کرتا ہوں
05:52
you will not see any difference
05:53
ٹھیک ہے
05:55
کوئی difference نہیں ہے
05:56
however
05:57
اگر by mistake
05:59
آپ اپنے function کو
06:01
نہ کوئی
06:02
argument دیتے ہیں
06:04
نہ keyword argument دیتے ہیں
06:06
اگر اب میں اس کو execute کرتا ہوں
06:07
تو what do you expect
06:08
جو default values آپ نے دی ہیں
06:11
وہ automatically replace ہو جائیں گی
06:12
یہاں پہ
06:12
i john you pay 10
06:14
i john you pay 10
06:15
however آپ نے کوئی بھی value نہیں دی ہوئی
06:16
یہ value
06:17
اس لیے یہاں پہ
06:18
automatically آگئی ہے
06:19
کہ
06:20
already آپ نے
06:21
default value دے دی ہوئی ہے
06:22
however
06:23
جب آپ کوئی نئی value دیتے ہیں
06:24
آپ کہتے ہیں
06:25
یار
06:25
let's say
06:26
pinto
06:28
pinto
06:30
اور pinto paid
06:31
let's say 25
06:32
اب جب اس کو execute کرتے ہیں
06:34
تو pinto basically override کر دے گا
06:36
john کو
06:36
ٹھیک ہے نا
06:38
یہ ہے default value
06:40
تو تین چیزیں ہم نے سیکھی
06:41
ایک تو ہم نے سیکھا
06:43
positional
06:44
positional کے spelling میں
06:45
غلط لیکھے ہیں
06:45
اپنے کیڑے نہیں نکالنے
06:46
spelling میں سے
06:47
positional
06:48
argument
06:50
دوسری چیز
06:51
argument
06:51
دوسری چیز ہم نے سیکھی
06:53
keyword argument
06:54
تیسری چیز ہم نے سیکھی
06:56
default parameters
06:57
تو چلیئے
06:58
ہم اس کو close کرتے ہیں
06:59
موسیقی
Recommended
6:57
|
Up next
Lecture 62: Learn differentiate Parameter and Argument
Nafees AI Lab
5/20/2025
6:41
Lecture 67: What are *args and **kwargs used for in Python functions?
Nafees AI Lab
5/21/2025
5:46
Lecture 64: Return Keyword in Python Programming
Nafees AI Lab
5/21/2025
0:27
Making waterproof shoes with duct tape! 👌🏞️
MetDaan Creative
4 days ago
0:16
When it's your boyfriend's laundry day! 😅🤣
MetDaan Creative
5 days ago
0:24
Spreading chocolate cream with a plaster! 😅🍞
MetDaan Creative
5 days ago
7:40
Mera Mazloom Hussain | Nadeem Sarwar 2020 | 1442
Gham-e-Hussain | غمِ حسینؑ
6/9/2025
9:38
Episode 1 – The Curious Boy from Ulm (1879-1895)
Nafees AI Lab
6/8/2025
0:37
Top Fully Funded Scholarships in Germany 2025 🇩🇪 | Apply Now!
Nafees AI Lab
6/3/2025
0:25
The Boy and the Dragon – “A Friend in the Sky”
Nafees AI Lab
6/3/2025
1:03
Why Do Rainbows Appear? 🌈 | Physics in Everyday Life
Nafees AI Lab
6/3/2025
0:28
Albert Einstein: The Genius Who Changed Time
Nafees AI Lab
6/1/2025
0:40
Stephen Hawking’s Life in 60 Seconds: From Wheelchair to the Universe
Nafees AI Lab
6/1/2025
0:36
The Forgotten Night Hitler Was Nearly Killed
Nafees AI Lab
5/29/2025
0:31
Dilip Kumar – The Tragedy King of Bollywood
Nafees AI Lab
5/29/2025
0:45
Marlon Brando – The Rebel Who Redefined Acting | Nafees AI Lab
Nafees AI Lab
5/29/2025
0:29
Charles Darwin – Evolution & Natural Selection | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:30
Isaac Newton – Gravity, Motion & Genius | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:52
Allama Iqbal – Poet of the East | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:53
Marie Curie – Life & Achievements | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:42
Albert Einstein – Life, Legacy & Discoveries | Nafees AI Lab
Nafees AI Lab
5/28/2025
10:08
Pandas Class 10: Manipulating Data – Sorting, Renaming & More
Nafees AI Lab
5/28/2025
12:30
Pandas Class 09: Adding & Removing Data in Pandas
Nafees AI Lab
5/28/2025
11:25
Pandas Class 08: Changing Data in Pandas – Replace & Update
Nafees AI Lab
5/28/2025
14:15
Pandas Class 07: More on Data Selection in Pandas
Nafees AI Lab
5/28/2025