I am doing this course in 2023.All your previous videos were good and likely to understand but i could not get anything from this one the average function and the others just went above my mind.
You are probably thinking why use return when you have print, or something like that. print just prints the result and forgets about it, like the c button on calculator. you saw it and that's that. but return keeps the result just in case if you want to use the result on somewhere else. also finishes the function.
Day 5 of #100DaysOfCode. Today in this video 21, I learned about four types of function arguments in Python: default, keyword, required, and variable-length arguments. Default arguments have preset values, while keyword arguments allow specifying values using key-value pairs. Required arguments need correct positional order, and variable-length arguments accommodate extra arguments. Additionally, the return statement is used to pass values from functions back to the calling function. Thank You Harry Bhaiya.
Harry Sir, I am a chemical engineering student and I have literally zero programming knowledge. However, I took up this challenge to learn my first ever programming language to try and widen my placement opportunities in core IT industries as well (They seem to have way more demand and opportunities for student today). So far, I'm so proud of myself for having written my first code, even though it would be considered very simple and basic, but I am extremely grateful to you! You make learning so much fun, interactive, and engaging, and I look forward to your videos every single day! Thank you so much sir (: We can never ever thank you enough :')
Only hard working is required, be puntual, and follow this harry's python course, strat from as firt programming langauge : 1. HTML, 2. CSS, 3rd : Javascript, 4th: Python. I recommend to you this road map of your career. and you can also watch a video on programming road map on youtube. okay Good Luck
Sir apke jese teacher lakho me milte hai thank you so much sir hmare liye itni mehnat krte ho aap 🥰🥰 i want to meet you at least one time in my life ❤❤❤
length=float(input("enter the length of box:")) width= float(input("enter the width of box:")) hight=float(input("enter the hight of box:")) volume =length*hight *width print("The volume of box is:",volume)
maza aa gaya sir , saare topics abhi tak ke crystal clear hain,main c ke baad python seekh raha hai and Python kaafi easy lag rahi hai c language se , thanks sir !!!!!!!!!!!!!!!!! i'll finish this series soon and move on c++
I like his videos. There is just one problem, he sometimes starts explaining a topic that he has not even started yet... And he expects people to understand it. But still, I definitely recommend you all to watch it.
Sir aap badiya samjate hai so proud of you sir .mai vaise Arts background se hun lekin Mai BCA kar raha hu. Mujhe programming language mai python kar raha hu.
def average(*numbers): print(type(numbers)) sum=0 for i in numbers: sum+=i print("average is:",sum/len(numbers)) average(2,4) print(type(numbers)) the output is: tuple 3 list how did it convert from tuple to list?
default arg= when value is given in function declaration keyword arg= when we give keyword of variables in calling the functions. if we want, we can change sequence of keywords and it wont affect the outcome. however, if we dont use keywords then sequence is mandatory. variable length args= when more arguments are being passed than those defined in the function. using *in declaring local variables allows function to treat provided arguments as a tuple(cannot be destroyed) and thus can be utilized repitetively. return will give control of the program to the calling statement of function.
for those who had that question that will the compiler understand if i specified value for b only and later define values for a and c will the compiler understand that the second value is for c no it wont a defined value cannot be followed by a non defined value
sum = 0 for i in numbers: sum = sum + i average(3, 5, 7) [ what the above statement did is 0+3+5+7 ] (Here initially sum was 0 but we gave new values i = (3, 5, 7 ) and by using for loop each value was added one by one ) *note (Don't mind me I'm explaining to myself to understand it better )
def average(*numbers): print(type(numbers)) total = 0 for i in numbers: total += i if len(numbers) == 0: return 0 # To avoid division by zero if no numbers are provided return total / len(numbers) result = average(5, 6) print("average is:", result)
Bhai TAB 3 arguments liye the (required arguments ke example me ) , waha par 3 se divide Krna tha .. Vo aap phle se 2 kr rhe the divide Toh skip ho gya ... THX! FOR GOOD EXPLANATION ❤🎉
Return () function will immediately stop the program and return the values and the commands given after the return function will not be executed. Edit : basically,it returns the value of the function to the calling function without executing the further code after calling of the return () function.
Return is not a funcion. It's a keyword. Return is used to store a value in a variable. You should check out the old python series for absolute beginners
Simple thing hai, Function jab run hota hai to value kahin na kahin as a output hamain chahye hoti hai .Aur function run ni hoskta jab tak app usse call na kerain ..Aur call kerne se pehle ham function ko variable dete hain taake ham uss main value store kerke use ker sakain program main
import time ok so basically I've applied some of knowledge until what things I've learned so far so good times = time.strftime('%H:%M:%S') greetings = print("Welcome to Maulik's Console", "it's", times, "May I know your Name ") name = input() print("How are you", name.capitalize()) mood = input().lower() if mood in ["good", "fine", "nice"]: print("So today which arithmetic operation would you like to perform?") work = input()
if work == "addition": print("Ok then let's begin with", work) some_input = input().lower() if some_input in ["yeah sure", "yeah", "ok"]: def num_add(a,b): output=a+b print("Result = ",output) print("Enter Your Number")
elif work in ("subtraction"): print("ok then let's begin with, Subtraction") some_input2 =input().lower() if some_input2 in ["yeah sure", "yeah", "ok"]: def num_sub(a,b): output=a-b print("Result = ",output) print("Enter Your Number")
elif work in ["multiplication","multiply"]: print("ok then let's begin with, Multiplication") some_input2 =input().lower() if some_input2 in ["yeah sure", "yeah", "ok"]: def num_multiply(a,b): output=a*b print("Result = ",output) print("Enter Your Number")
elif work in ["division","Division"]: print("ok then let's begin with, division") some_input2 =input().lower() if some_input2 in ["yeah sure", "yeah", "ok"]: def num_div(a,b): output=a//b print("Result = ",output) print("Enter Your Number") no1 = float(input()) no2 = float(input()) num_div(no1, no2)
elif work in ("mean"): print("ok then let's begin with, mean") some_input2 =input().lower() if some_input2 in ["yeah sure", "yeah", "ok"]: def num_mean(a,b): output=(a+b)/2 print("Result = ",output) print("Enter Your Number")
no1 = float(input()) no2 = float(input()) num_mean(no1, no2) else: print("Ok Then See You Tomorrow")
start = int(input("Enter Start Number : ")) stop = int(input("Enter Stop Number : ")) lst= [i for i in range(start,stop) if i%2==0] print(lst) print even number in 4 line of code thanks harry bhai :)
Bara sath sath ho rhy ho harry ky .... Asa kro apna jisam bee day do Harry ko... kuch ratoon ky liy . Smj toh gy ho gy ab tum .(sex wgerah krny ky liy)
Also everyone please make sure that non default arguments must always come before default arguments in case of Required arguments or we will have error.
7:45 #harry_bhai Unlike Java, JS where in built methods or functions are written as a.length(); a.length; But python's syntax for the same function is len(a) Co-incidentally user-defined functions are written as def length(a): print(len(a)) So if a programmer accidentally names a function name by the name of a built in function then an error will occur. If that is the case then one must be thoroughly aware of all the built in function. So are there any measures to mitigate these inevitable errors.
I think you should have made a full new video on return statement, cause may be experienced people understand that but fresher like me do not understand anything about return statement
Bro 21 Days ho gay but all these are basic concepts we have already done... Please come to towards OPP and Data Structures of Python... And please make some little Projects....
00:00 Function Arguments 01:50 There are 4 types of arguments in a function. 03:15 Default Arguments and Keyword Arguments 05:04 Required Arguments are mandatory to provide 06:44 Finding the average of numbers using a for loop 08:46 Understanding the average of numbers 10:22 The 'Average' function returns the average of all numbers. 11:58 The return statement is used to return the value Of the expression back to the calling function. Crafted by Merlin AI.
#harrybhai @CodeWithHarry def average(*Numbers): sum = 0 for i in Numbers: sum = sum + 1 print("Average is ", sum / len(Numbers)) average(5, 6) This code keeps giving an error of Number in the print statement is not defined.
One question: Cound you please tell the use of iteration in this average making program? Sum is initialised as 0 and we also giving inputs as 5 6 7 1. After iteration, it will be 1 right, so how can it takes 5 or 6
Day #21 done! Learning programming is much more compelling when we are gifted with a teacher like you!
@USMAN SYED PAKISTANI I'm from Bangladesh 😃
@USMAN SYED PAKISTANI India
@@mariamhasan3733 এটা আপনি সম্পূর্ণ শেষ করেছেন?
I am doing this course in 2023.All your previous videos were good and likely to understand but i could not get anything from this one the average function and the others just went above my mind.
me too
Ha bhai maine same program likha par mera error aa raha hai
Koi msla nhi practice kro sab set hjye ga
level up ho rha
Same bro !! Doing in 2024 ...
Maybe it is because this is my 1st time coding .....but I understand all chapters that were before 21..
You are probably thinking why use return when you have print, or something like that.
print just prints the result and forgets about it, like the c button on calculator. you saw it and that's that.
but return keeps the result just in case if you want to use the result on somewhere else.
also finishes the function.
👍
@devangjoshi4932 yoo i was searching the comments to see if someone else had the same doubt and you helped me to clear my doubt...
TYSM Bro
Thanks
Day 5 of #100DaysOfCode. Today in this video 21, I learned about four types of function arguments in Python: default, keyword, required, and variable-length arguments. Default arguments have preset values, while keyword arguments allow specifying values using key-value pairs. Required arguments need correct positional order, and variable-length arguments accommodate extra arguments. Additionally, the return statement is used to pass values from functions back to the calling function.
Thank You Harry Bhaiya.
Sir me and my brother both watching you from Bangladesh. Thank you sir for teach us , Allah may bless you.
❤️ from Pakistan
Please take an English class in Bangladesh.
It will be beneficial for you 🙏
@@KoushikDas2005 An English class*
@@swapneel9276 yaa.
@@swapneel9276 Lol 😂😂
Harry Sir,
I am a chemical engineering student and I have literally zero programming knowledge. However, I took up this challenge to learn my first ever programming language to try and widen my placement opportunities in core IT industries as well (They seem to have way more demand and opportunities for student today). So far, I'm so proud of myself for having written my first code, even though it would be considered very simple and basic, but I am extremely grateful to you! You make learning so much fun, interactive, and engaging, and I look forward to your videos every single day! Thank you so much sir (: We can never ever thank you enough :')
agreed every bit,
congrats on your development till now !
hi broh i am also chemical student i grd on bsc chemistry but now i switch my carrer in it fild now i am studying mca(master of computer application)
Fake
Wow 😲 kay bat hay yar 👍
Only hard working is required, be puntual, and follow this harry's python course, strat from as firt programming langauge : 1. HTML, 2. CSS, 3rd : Javascript, 4th: Python. I recommend to you this road map of your career. and you can also watch a video on programming road map on youtube. okay Good Luck
Sir apke jese teacher lakho me milte hai thank you so much sir hmare liye itni mehnat krte ho aap 🥰🥰 i want to meet you at least one time in my life ❤❤❤
Best series on any programming language
God bless you sir aapkai aaisai logao ka jarurat hai desh ko jo free of education
Code with harry == possible👍
Code without harry == Impossible👎
❓ AGREE❓
Agree 💯
@@tajindersingh7891 GD
I 💯
Right
Possible
Pls add a quiz or homework kind of thing so that we can clear our concepts perfectly
Yes, It Can Help Us
length=float(input("enter the length of box:"))
width= float(input("enter the width of box:"))
hight=float(input("enter the hight of box:"))
volume =length*hight *width
print("The volume of box is:",volume)
def retrn():
cwt = ("Wapis Chale Jaaooon is Value ko Leke")
for i in cwt:
print(cwt)
retrn()
maza aa gaya sir , saare topics abhi tak ke crystal clear hain,main c ke baad python seekh raha hai and Python kaafi easy lag rahi hai c language se , thanks sir !!!!!!!!!!!!!!!!! i'll finish this series soon and move on c++
Def average(*x):
a = sum(x)
If 0 in x:
b = len(x) - x.count(0)
Else:
b = len(x)
print(a/b)
I like his videos. There is just one problem, he sometimes starts explaining a topic that he has not even started yet... And he expects people to understand it. But still, I definitely recommend you all to watch it.
Please watch whole video properly he has told that he will discuss properly when he will teach dictionary and tuples in future.
Greeting(x):
Print("Thankyou so much ", x+str(" bhai"))
Greeting("Harry")
Sir aap badiya samjate hai so proud of you sir .mai vaise Arts background se hun lekin Mai BCA kar raha hu. Mujhe programming language mai python kar raha hu.
def average(*numbers):
print(type(numbers))
sum=0
for i in numbers:
sum+=i
print("average is:",sum/len(numbers))
average(2,4)
print(type(numbers))
the output is:
tuple
3
list
how did it convert from tuple to list?
default arg= when value is given in function declaration
keyword arg= when we give keyword of variables in calling the functions. if we want, we can change sequence of keywords and it wont affect the outcome. however, if we dont use keywords then sequence is mandatory.
variable length args= when more arguments are being passed than those defined in the function. using *in declaring local variables allows function to treat provided arguments as a tuple(cannot be destroyed) and thus can be utilized repitetively.
return will give control of the program to the calling statement of function.
for those who had that question that will the compiler understand if i specified value for b only and later define values for a and c will the compiler understand that the second value is for c no it wont a defined value cannot be followed by a non defined value
Now i am getting on track, “slowly and steadily “😊😊
Return ka matlab wapas chale jao value ko leke
# thanks for teaching Me HarrySir You're the best!
Bhaiya ek baar return keyword pr ek detail video banadijiye!? 😅😅
harry sir aapka padhane ka trika bhut achha he aap ka smjhaya hua ek bar smjhne pr smjh ajata he long time tk mind me rehta he 😇😇
sum = 0
for i in numbers:
sum = sum + i
average(3, 5, 7)
[ what the above statement did is 0+3+5+7 ]
(Here initially sum was 0 but we gave new values i = (3, 5, 7 ) and by using for loop each value was added one by one )
*note (Don't mind me I'm explaining to myself to understand it better )
Sir I have not understood this example
def average(*numbers):
sum=0
for i in numbers:
sum=sum+i
print("Average is:",sum/len(numbers))
average(4,6)
Hame bhi n aya
def average(*numbers):
print(type(numbers))
total = 0
for i in numbers:
total += i
if len(numbers) == 0:
return 0 # To avoid division by zero if no numbers are provided
return total / len(numbers)
result = average(5, 6)
print("average is:", result)
def name(**new):
result = ""
for key in new:
result += new[key]
return result
name(name="Ayush",age="19",gender="male")
Bhai
TAB 3 arguments liye the (required arguments ke example me ) , waha par 3 se divide Krna tha ..
Vo aap phle se 2 kr rhe the divide
Toh skip ho gya ...
THX! FOR GOOD EXPLANATION ❤🎉
#return statement example
def pizza_boy(*pizza):
return pizza
my_parcel=pizza_boy("one onion pizza", "two cheese pizza")
print(my_parcel)
Return mtlb wapas chle jao uss value ko le kr....
hllo
Hello Harry Can you make same playlist for MySQL
finally ,i understand def funtion after watch this video 6 times
Return=go back with value
Such a great educator aallaa haffis , from iraq, (the karela story )
Harry bhai Spring framework pe bhi ek bar to course bnao
Harry bhai, i am totally confused about return function. Pls makes a video on return () . What is need of return () .
Return () function will immediately stop the program and return the values and the commands given after the return function will not be executed.
Edit : basically,it returns the value of the function to the calling function without executing the further code after calling of the return () function.
Return is not a funcion. It's a keyword.
Return is used to store a value in a variable.
You should check out the old python series for absolute beginners
Simple thing hai, Function jab run hota hai to value kahin na kahin as a output hamain chahye hoti hai .Aur function run ni hoskta jab tak app usse call na kerain ..Aur call kerne se pehle ham function ko variable dete hain taake ham uss main value store kerke use ker sakain program main
@@krishna290gamer2 yahan v smjh skte hein
Day 21 of Coding. Present Sir.
import time
ok so basically I've applied some of knowledge until what things I've learned so far so good
times = time.strftime('%H:%M:%S')
greetings = print("Welcome to Maulik's Console", "it's", times, "May I know your Name ")
name = input()
print("How are you", name.capitalize())
mood = input().lower()
if mood in ["good", "fine", "nice"]:
print("So today which arithmetic operation would you like to perform?")
work = input()
if work == "addition":
print("Ok then let's begin with", work)
some_input = input().lower()
if some_input in ["yeah sure", "yeah", "ok"]:
def num_add(a,b):
output=a+b
print("Result = ",output)
print("Enter Your Number")
no1 = float(input())
no2 = float(input())
num_add(no1, no2)
elif work in ("subtraction"):
print("ok then let's begin with, Subtraction")
some_input2 =input().lower()
if some_input2 in ["yeah sure", "yeah", "ok"]:
def num_sub(a,b):
output=a-b
print("Result = ",output)
print("Enter Your Number")
no1 = float(input())
no2 = float(input())
num_sub(no1, no2)
elif work in ["multiplication","multiply"]:
print("ok then let's begin with, Multiplication")
some_input2 =input().lower()
if some_input2 in ["yeah sure", "yeah", "ok"]:
def num_multiply(a,b):
output=a*b
print("Result = ",output)
print("Enter Your Number")
no1 = float(input())
no2 = float(input())
num_multiply(no1, no2)
elif work in ["division","Division"]:
print("ok then let's begin with, division")
some_input2 =input().lower()
if some_input2 in ["yeah sure", "yeah", "ok"]:
def num_div(a,b):
output=a//b
print("Result = ",output)
print("Enter Your Number")
no1 = float(input())
no2 = float(input())
num_div(no1, no2)
elif work in ("mean"):
print("ok then let's begin with, mean")
some_input2 =input().lower()
if some_input2 in ["yeah sure", "yeah", "ok"]:
def num_mean(a,b):
output=(a+b)/2
print("Result = ",output)
print("Enter Your Number")
no1 = float(input())
no2 = float(input())
num_mean(no1, no2)
else:
print("Ok Then See You Tomorrow")
❤
@@JuttTiger thanks bro
well done!
6:16 it will be:
print("The average is", (a + b + c / 3)
not print("The average is", (a + b + c / 2)
Hlw brother can you explain 7:10
Why did for loop use and why sum = sum + i
a = 20
b = 65
def gmaean(a,b):
mean = (a)//(b)
print (mean)
how to find Using function method find even number and also max or min using list
List=[1,2,32,31,6,8,7]
Yes bhaiya successfully run kr diya required function very simple bs maine shuru mein lname ko name bta diya or fname,mname niche se mill gya
You have to add one more condition on printing yku ere getting closer
Play != 17
Or whatever is cirrect answer
function ke ander return ka matlab usko jo value mili hogi return statement ke doran woh value wapas leke chala jayega function ke bahar samjha
I am with you sir very nice work
nicely explained,,,,,well done bruther
Day 21 done ✅
start = int(input("Enter Start Number : "))
stop = int(input("Enter Stop Number : "))
lst= [i for i in range(start,stop) if i%2==0]
print(lst)
print even number in 4 line of code thanks harry bhai :)
wow...........!
bro how this happen?
in 3rd line " i for " me i pehle kyu ?
Tnx sir 😊
As a c++ user python, do not have any essence no pointers no pass by reference it's too high level and abstract
Mujhe bharosa nhi ho rha h Coding itna easy hai but koi baat nhi Harry bhai ke sath sab easy and possible hai all the best 👍
Bara sath sath ho rhy ho harry ky ....
Asa kro apna jisam bee day do Harry ko... kuch ratoon ky liy .
Smj toh gy ho gy ab tum .(sex wgerah krny ky liy)
@@Zerocoment-zh6bq ab faltu log ko kya hi bolu
@@mithleshverma9055 buss bolo kuch nai apna jisam us ky name kr do .
Maza aa raha hai Harry bhai
your teaching method is better than others
#DAY21 COMPLETED
THANK U #CodeWithHarry
Return Statement ka mtlb hai wapas chale jao iss value ko leke...
return means ----> Take this value and go back
Day 21 complete...
But where is Variable length Arguments.....
thanks harry bhaiya for your contribution
sir please make a playlist of DSA in python and java
12:00 return matlab wapas chale jao iss value ko leke.
level bd gaya hai harry bhai.......sar ke upper se jana shuru ho gaya hai
Also everyone please make sure that non default arguments must always come before default arguments in case of Required arguments or we will have error.
6:28 getting error missing required positional name
Hello sir, please explain, why you took Sum = 0
Harry Bhai please make course on Flutter App Development
7:45 #harry_bhai
Unlike Java, JS where in built methods or functions are written as
a.length();
a.length;
But python's syntax for the same function is
len(a)
Co-incidentally user-defined functions are written as
def length(a):
print(len(a))
So if a programmer accidentally names a function name by the name of a built in function then an error will occur.
If that is the case then one must be thoroughly aware of all the built in function.
So are there any measures to mitigate these inevitable errors.
cool
That can only be achieved through practice , you can't just simply remember all the built in functions name
return ka matlab: wapis chale jao is value ko le k
Harry bhai next course " Mern stack " rakho plz
I'm not first but present everyday
You are great sir 👍👌
i am eagerly waiting for dict....bcos i need my 5th star in hackerrank
i got my 4 stars only with the learnings from you....
thank you sir
What is heckerrank
Day-21 present sir ✋✋
LOVE YOU HARRY BHAI❤
HARRY BHAI ;- HOWS THE JOSH
ME ; - HIGH SIR🤠🤠🤠🤠🤠🤠
aaj finally pata chala different arguments ke bare me
I think you should have made a full new video on return statement, cause may be experienced people understand that but fresher like me do not understand anything about return statement
Exactly👍👍👍👍👍
Wahi
return matlab
wapis chale jao is value ko le ke
Return 7
Return a+b
Function returns first result, not the 2nd return.
Bro 21 Days ho gay but all these are basic concepts we have already done...
Please come to towards OPP and Data Structures of Python...
And please make some little Projects....
return = vapas chala jayega
sir, there is a small mistake in the formula of average it should be (a+b+c)/3 instead of (a+b+c)/2
00:00 Function Arguments
01:50 There are 4 types of arguments in a function.
03:15 Default Arguments and Keyword Arguments
05:04 Required Arguments are mandatory to provide
06:44 Finding the average of numbers using a for loop
08:46 Understanding the average of numbers
10:22 The 'Average' function returns the average of all numbers.
11:58 The return statement is used to return the value Of the expression back to the calling function.
Crafted by Merlin AI.
Sir, i dont know about others,but i wil be the one who will be with you till your 100th day video comes.❤
Me also
I hope you completed your 100th day?
Yo bro🌝i finished simultaneously with Harry bhai
@@user-gk3bw3wc7l
So you finished Day 100? If yes, did it really helped you?
Day 22 Done ✅ #100DayOfCode
return statement is used to return the value of the expression back to the calling function
Return vaaps chala jayega 12:19
Arguments are actual 😊
12:05 -> return means wapas lekar chale jao
Harry Sir I Became a Game maker
So what I do please tell me
bhai aadi janta aapse hi coding sikhi hai thanks
# default argument
def FunDef(name,surname='king'):
print("hello",name,"your surname is ", surname)
FunDef('vaibhav')
# keyword argument
def FunKey(name,sal,city,country,age,address):
naam=name
salary=sal
shahar=city
desh=country
umar=age
pta=address
print(naam,salary,shahar,desh,umar,pta)
FunKey(address='rajnagar',name='vaibhav',age=22,sal=200000,country='india',city='indore')
# variable length
def FunVar(*marks):
sum=0
length=len(marks)
for i in marks:
sum=sum+i
percentage=sum/length
print(percentage)
FunVar(50,76,56,80,48)
return ="wapas chale jao is value ko lekar"
#harrybhai
@CodeWithHarry
def average(*Numbers):
sum = 0
for i in Numbers:
sum = sum + 1
print("Average is ", sum / len(Numbers))
average(5, 6)
This code keeps giving an error of Number in the print statement is not defined.
Completed DAY#21 😍
I want to be a full stack developer. I've done C, C++, Python, and Java so far.
Please advise me on what language should to learn. Please guide me❣🙏🙏
Learn this one by one -
1. HTML
2. CSS
3. Bootstrap
4. Javascript
5. DBMS
6. react
Learn Scratch
xD
@@aadityabasak Thankyou bhai
@@krishna290gamer2 I don't know bro what this is, please tell me about this course
Cancel
Reply
Spring boot, hibernate,JavaScript
One question:
Cound you please tell the use of iteration in this average making program? Sum is initialised as 0 and we also giving inputs as 5 6 7 1. After iteration, it will be 1 right, so how can it takes 5 or 6
same question
Harry bhaiya maja aagya mene vdo late dekhi h but i enjoyed this vdo😁
return ka mtlb "wapas chale jao ush value ko leke"
'Return' means take this value and go back.
reaturn ja matlab vapas chale jao is value ko leke :)