Thanks you for your clear step-by-step explanation on Euclidean algorithm using small case, 64 & 48. I could understand "why 'a' should be returned " clearly and the recursive function a little bit more. I have subscribed!! I hope you and your beloved ones staying healthy and happy.
@@AmulsAcademy mam I don't understand the explanation bcs when you used return why only a is getting printed i.e only if condition is getting printed and not the else condition
The easiest method is to divide the greatest number by the second one and then divide the greatest number by numerator of the result. Don't ask me how but it actually works and so efficient 😀
when i take a= 4 b = 18 then here we can see a here we can see value is interchanged. first value becomes 18 and second value becomes 4, then it will execute the function. so no need to check whether a is greater then b or not :)
Ma'am mine method for calculating GCD/HCF is correct or not ? Num1 = int(input("Enter the first number : ")) Num2 = int(input("Enter the second number : ")) factors = [] for fact in range(Num1,0,-1): if Num1 % fact == 0 and Num2 % fact == 0: factors.append(fact) print("HCF of ",Num1,"and",Num2,"is : {}".format(max(factors)))
Yes it will work :) But you didn't check for the smallest input,. when you enter the first value as bigger value, for loop will execute more times than required . The H.C.F can only be less than or equal to the smallest number, so no need to check till bigger number. :)
mam ,pl explain this hi mam , i understand this program but according to the if "loop" it should get the values " 2,3 or 4" as GCD coz it divides 48,36 equally how it gets 12 as GCD . n1 = 48 n2 = 36 #find smaller if(n1>n2): smaller = n2 else: smaller = n1 #getting hcf i = 1 while(i
greatest common divisor of 48 and 36 is 12. common divisor of 48 and 36 is 1 2 3 4 6 12 In this greatest is 12 so GCD is 12. In the program while loop will run until i
Hello Amulus,Thank You for the video you did on GCD I will always recommend you to my friend for your wonderful teaching And amulus just a small request apart from the GCD programme you did can u also do a video on Conversion from Hexadecimal to decimal it's a bottom hearted request pls do it for me
No you can write program without recursion also(iterative approach). But for some problems using recursion is best choice because of its simplicity. There are many articles on "how to think recursively in python". You can refer that. :)
Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(
if I take 3 values . it will execute or not.your explanation is super. sister I will give input in string and I want output into numbers .you will execute this programme
for three values you need to use reduce, import functools def gcd(a,b): if(b==0): return a else: return gcd(b,a%b) a=int(input("Enter first number:")) b=int(input("Enter second number:")) c=int(input(":")) GCD=functools.reduce(gcd,(a,b,c)) print("GCD is: ") print(GCD) :)
I have a easy method we can do like this we put statemnt if num1%i ==0 and num2%i ==0 Then we will set range to (0,smallernum) And add this to a new list and last number will always be largest number so we will return lis[-1]
I think you are asking manually how to find out the gcd of bigger numbers. There are some mathematical shortcuts you need search that, you can google it. :)
list1=[] list2=[] for i in range(2,n1): if n1%i==0: print(i, end=',') list1.append(i) print(" ") for j in range(2,n2): if n2%j==0: print(j, end=',') list2.append(j) list3=[] for i in list1: for j in list2: if i==j: list3.append(i)
def gcd(n,m): if m==0: return n elif n==0: return m else: return(gcd(m,n%m)) n=int(input()) m=int(input()) k=gcd(n,m) print(k) i think this is the correct code
Had to watch the last part a few times but damn thank you so much cause now I get it! Solving some Python Basic challenges from W3R schools and didnt really get this one...TILL NOW 😊😊🤣🤣😉😎😎
Thanks you for your clear step-by-step explanation on Euclidean algorithm using small case, 64 & 48. I could understand "why 'a' should be returned " clearly and the recursive function a little bit more. I have subscribed!!
I hope you and your beloved ones staying healthy and happy.
Thank you so much :)
Stay happy Stay Healthy :)
i really like the way you explain coding!! so clear and to the point! really thanks for the vid!
You are AMAZING!!! You explained it perfectly!!!!! I subscribed
Thank you :)
subscribed as well.
@@AmulsAcademy mam I don't understand the explanation bcs when you used return why only a is getting printed i.e only if condition is getting printed and not the else condition
@@AmulsAcademy You are seriously amazing, thank you for this.
Easy method
Def(num1,num2)
Lis = []
For i in range (1,num1):
If num1 % i ==0 and num2 % i ==0:
Lis.append(i)
Return lis[-1]
zero division error
as a curiosity you can also write
def GCD(a,b):
return a if b==0 else GCD(b,a%b)
if anyone is obsessed with shortcode :))
True :)
very good videos. i am a beginner coder and your tutorials really helped me out!!
Glad to hear that 😊
Your channel is fantastic! There's no word to describe my gratitude to you
Thank you :)
I understood it very well, every step was explained in detailed manner .
Amazing tutorial.
Take love from Bangladesh 🇧🇩
Thank you 😊
Wow...what's that...Your voice is so cute...Of course you explained it perfectly...your voice added more flavor to your explanation skill.......
Thank you :)
ngl this comment is creepy as hell
There is no words to describe ur explanation, u r excellent sister☺️
I just addicted to ur voice
Thank you :)
Wow that was me who completed 1k likes on this video
Btw you deserve much more than that. Really loved it ❤
Thank you so much :)
Thanks for the simple and pre-concept explanation. Thanks again !
I had a terrible stop at this point. Thank you very much.
Welcome :)
Thanks Amul, this helped me enormously.
Glad to hear that!
Hat's-Off Ma'am, Amazing!! Will remember for life time
That was a great explanation..👏 Thank you from Korea!
Guys a simple program which you can try for GCD
a=int(input ("enter greater no"))
b=int(input ("enter smaller no"))
while r>0:
r=a%b
a=b
b=r
print (a)
Great😊 explanation
❤ for your lovely voice 🤗🙏
Thanks a lot 😊
great...greater...greatest....programmer...I have ever seen ..take love from me.
Thank you :)
The way you explained is awesome 🤩🙌
Thank you so much 😀
Amazing explanation!!!! And beautiful voice:)
Thank you :)
The easiest method is to divide the greatest number by the second one and then divide the greatest number by numerator of the result.
Don't ask me how but it actually works and so efficient 😀
It is a best channel to learn python 🥰
Thanks mam your explanation was top notch
Absolutely amazing explanation. So clear. Thanks very much.
Glad it was helpful!
Great explanation Mam!
Thank you 😊
it's fantastic way to define exact mean of math & Programming concepts ....Really Good for your knowledge & teaching terms.
Thank you :)
Thank you very much again for your detailed explaination!
Pleasure ❤️
Uff.. tmhara voice ♥️👌 ..nice explanation though.. very helpful
Thanks a lot 😊
ur explanation before writing code is awesome ....is there any paid course of yours i would like to join ...thank you madam
You got a new subscriber.
Great explanation
Thank you :)
Ur video contained so much explanation thank u 😘💕
Thank you :)
Perfect explanation I subscribed ❤️
Thank you 😊
Sister mi voice tone👌 and good explanation
Mam thankyou so much for your nice explanation 🙏
Graet Video.very simple and clear expanation thank you very much
Thanks amulya .
Pleasure :)
Good explanation 👍👍
Ma'am, You're awesome, Thanks for the video...
My pleasure 😊
Amulya's Academy 🥰😘
nice and clear explanation,thank you
Thank you :)
Why it is not necessary to mention a>b....How a%b works in this program even when a
when i take a= 4
b = 18
then here we can see a here we can see value is interchanged. first value becomes 18 and second value becomes 4, then it will execute the function.
so no need to check whether a is greater then b or not
:)
Really great.Thank you🙏🙏
Pleasure 😊
super explained in very simpleway
Nice work..
Thank you :)
❤️👍👍 well explanation
Thank you 😊❤️
Ma'am when i wrote
>>> math.gcd(64,48) , you tell it will come 16 but in mines it is 1, can you tell the problem???
simply amazing individual.....
Thank you :)
Crystal clear....🔮
Thank you so much mam🤗😁
Most welcome 😊
Ma'am mine method for calculating GCD/HCF is correct or not ?
Num1 = int(input("Enter the first number : "))
Num2 = int(input("Enter the second number : "))
factors = []
for fact in range(Num1,0,-1):
if Num1 % fact == 0 and Num2 % fact == 0:
factors.append(fact)
print("HCF of ",Num1,"and",Num2,"is : {}".format(max(factors)))
Yes it will work :)
But you didn't check for the smallest input,.
when you enter the first value as bigger value, for loop will execute more times than required .
The H.C.F can only be less than or equal to the smallest number, so no need to check till bigger number.
:)
Great explain ... Thank you so much
You are welcome! : )
mam ,pl explain this
hi mam , i understand this program but according to the if "loop"
it should get the values
" 2,3 or 4" as GCD coz it divides 48,36 equally how it gets 12 as GCD .
n1 = 48
n2 = 36
#find smaller
if(n1>n2):
smaller = n2
else:
smaller = n1
#getting hcf
i = 1
while(i
greatest common divisor of 48 and 36 is 12.
common divisor of 48 and 36 is 1 2 3 4 6 12
In this greatest is 12 so GCD is 12.
In the program while loop will run until i
@@AmulsAcademy oh ok . i got it now 😃. thank u very much mam .
NICE VOICE
GREAT EXPLAINATION
KEEP IT UP :)
Thank you :)
Thanks for explaining it so cleary
You're welcome! :)
WOW, you are so good, Thank You so much for your help.
def gcd_function(a,b):
big=max(a,b)
small=min(a,b)
# print(big)
# print(small)
reminder=big%small
while reminder!=0:
big=small
small=reminder
reminder=big%small
print(small)
number=10
number1=20
print(gcd_function(number,number1))
Hello Amulus,Thank You for the video you did on GCD I will always recommend you to my friend for your wonderful teaching
And amulus just a small request apart from the GCD programme you did can u also do a video on Conversion from Hexadecimal to decimal it's a bottom hearted request pls do it for me
Sure:)
Amuls Academy
Amulus when can u do this video for me
Next week:)
Hi Amulya how to develop logics like this and did each program logic needs base and recursive cases
is that the recursive code?
No you can write program without recursion also(iterative approach).
But for some problems using recursion is best choice because of its simplicity.
There are many articles on "how to think recursively in python". You can refer that.
:)
Yes:)
@linkmageful
will it possible to have all your code in mail?
Your voice is so cute thanks for you
Excellent explain
Glad it was helpful!
Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(
Thankyou so much mam.......
Pleasure :)
Mam , how did it run multiple times in function call?
And what is the algorithm for this gcd program, can u please tell me.
Euclid's algorithm :)
mam do u have any udemy course ....if soo plz share the link.....
No :)
@@AmulsAcademy hoo its ok
Great, thanks😇
You're welcome 😊
You are awesome mam
Thank you 😊
if I take 3 values . it will execute or not.your explanation is super. sister I will give input in string and I want output into numbers .you will execute this programme
Good teaching....
for three values you need to use reduce,
import functools
def gcd(a,b):
if(b==0):
return a
else:
return gcd(b,a%b)
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
c=int(input(":"))
GCD=functools.reduce(gcd,(a,b,c))
print("GCD is: ")
print(GCD)
:)
Thank you:)
Thanks a lot mam!!
Pleasure 😊
Thankyou so much
Pleasure :)
What if we remove return statement from ComputeGCD
Try :)
is this the recursive form?
Yes:)
Tq sister excellent explain but I need one program thats are Pascale coding plzz put it....
I have a easy method we can do like this we put statemnt if num1%i ==0 and num2%i ==0
Then we will set range to (0,smallernum)
And add this to a new list and last number will always be largest number so we will return lis[-1]
Mam in first case i.e 4%18 you got 4. Can you please explain how did you get that?
If a and b are complex numbers, how can I find gcd. Please help me
you are explain perfect ...!!!!!!
Thank you :)
Ma'am how 2 find
Gcd of big no.
As like
3997 & 2947
I think you are asking manually how to find out the gcd of bigger numbers.
There are some mathematical shortcuts you need search that, you can google it.
:)
good mam and example more porgramm
Thank you :)
list1=[]
list2=[]
for i in range(2,n1):
if n1%i==0:
print(i, end=',')
list1.append(i)
print("
")
for j in range(2,n2):
if n2%j==0:
print(j, end=',')
list2.append(j)
list3=[]
for i in list1:
for j in list2:
if i==j:
list3.append(i)
print("HCF is",max(list3))
Is this ok?
*I don't know ur name but tq yaar 💝💝*
Pleasure :)
My name is Amulya.
Thank you!!
I need your video about LCM
Noted :)
import math
a = math.lcm(n1,n2)
print(a)
Thank you
Mam can u pls do LCM of 2 numbers programs pls...
Super mam ❤️
I love you thank you
Pleasure :)
def gcd(n,m):
if m==0:
return n
elif n==0:
return m
else:
return(gcd(m,n%m))
n=int(input())
m=int(input())
k=gcd(n,m)
print(k)
i think this is the correct code
Had to watch the last part a few times but damn thank you so much cause now I get it! Solving some Python Basic challenges from W3R schools and didnt really get this one...TILL NOW 😊😊🤣🤣😉😎😎
thanks
Welcome :)
Challa bagundhi
Thank you 😊
I need help Mam. I want the code for LCM
I will make a video on that soon :)
@@AmulsAcademy Hi, we are still waiting :)
Explain how to read values seperated by comma
Give a detail information about merge sort sister
Sure:)
Thq sis
subscribed..reallly u are amazing
Thank you so much 😀
Output showing ComputeGCd not defined
How to make a program to find the LCM
And how to make a program to find the second lowest numbers from given n numbers.
gd perfect thank s so much
Welcome :)