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 :)
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
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) :)
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. :)
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)
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 ,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
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!! :(
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. :)
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
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. :)
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 :)
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.
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 :)
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
i really like the way you explain coding!! so clear and to the point! really thanks for the vid!
very good videos. i am a beginner coder and your tutorials really helped me out!!
Glad to hear that 😊
I understood it very well, every step was explained in detailed manner .
Your channel is fantastic! There's no word to describe my gratitude to you
Thank you :)
Amazing tutorial.
Take love from Bangladesh 🇧🇩
Thank you 😊
There is no words to describe ur explanation, u r excellent sister☺️
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
ur explanation before writing code is awesome ....is there any paid course of yours i would like to join ...thank you madam
I just addicted to ur voice
Thank you :)
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)
Thanks Amul, this helped me enormously.
Glad to hear that!
I had a terrible stop at this point. Thank you very much.
Welcome :)
That was a great explanation..👏 Thank you from Korea!
Thanks for the simple and pre-concept explanation. Thanks again !
Hat's-Off Ma'am, Amazing!! Will remember for life time
The way you explained is awesome 🤩🙌
Thank you so much 😀
Thanks mam your explanation was top notch
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 :)
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 😀
great...greater...greatest....programmer...I have ever seen ..take love from me.
Thank you :)
Great explanation Mam!
Thank you 😊
Thanks amulya .
Pleasure :)
Thank you very much again for your detailed explaination!
Pleasure ❤️
It is a best channel to learn python 🥰
Absolutely amazing explanation. So clear. Thanks very much.
Glad it was helpful!
Amazing explanation!!!! And beautiful voice:)
Thank you :)
Graet Video.very simple and clear expanation thank you very much
Great😊 explanation
❤ for your lovely voice 🤗🙏
Thanks a lot 😊
Perfect explanation I subscribed ❤️
Thank you 😊
You got a new subscriber.
Great explanation
Thank you :)
it's fantastic way to define exact mean of math & Programming concepts ....Really Good for your knowledge & teaching terms.
Thank you :)
Mam thankyou so much for your nice explanation 🙏
Ur video contained so much explanation thank u 😘💕
Thank you :)
super explained in very simpleway
simply amazing individual.....
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
:)
Ma'am, You're awesome, Thanks for the video...
My pleasure 😊
Amulya's Academy 🥰😘
Thanks for explaining it so cleary
You're welcome! :)
Great explain ... Thank you so much
You are welcome! : )
Good explanation 👍👍
Really great.Thank you🙏🙏
Pleasure 😊
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:)
nice and clear explanation,thank you
Thank you :)
Sister mi voice tone👌 and good explanation
Uff.. tmhara voice ♥️👌 ..nice explanation though.. very helpful
Thanks a lot 😊
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))
Nice work..
Thank you :)
Tq sister excellent explain but I need one program thats are Pascale coding plzz put it....
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:)
Excellent explain
Glad it was helpful!
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.
:)
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?
Crystal clear....🔮
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???
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]
NICE VOICE
GREAT EXPLAINATION
KEEP IT UP :)
Thank you :)
Mam , how did it run multiple times in function call?
Thankyou so much mam.......
Pleasure :)
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 .
Mam in first case i.e 4%18 you got 4. Can you please explain how did you get that?
❤️👍👍 well explanation
Thank you 😊❤️
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!! :(
What if we remove return statement from ComputeGCD
Try :)
Thank you so much mam🤗😁
Most welcome 😊
Thanks a lot mam!!
Pleasure 😊
Thankyou so much
Pleasure :)
you are explain perfect ...!!!!!!
Thank you :)
Explain how to read values seperated by comma
I need your video about LCM
Noted :)
import math
a = math.lcm(n1,n2)
print(a)
You are awesome mam
Thank you 😊
Great, thanks😇
You're welcome 😊
Greatest common divisor in the sense greatest common factor right ?
Your voice is so cute thanks for you
Mam can u pls do LCM of 2 numbers programs pls...
WOW, you are so good, Thank You so much for your help.
Output showing ComputeGCd not defined
If a and b are complex numbers, how can I find gcd. Please help me
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.
:)
I love you thank you
Pleasure :)
Challa bagundhi
Thank you 😊
good mam and example more porgramm
Thank you :)
Well, you could have checked for the reminder, then return b. Anyway, only one step will be reduced
mam do u have any udemy course ....if soo plz share the link.....
No :)
@@AmulsAcademy hoo its ok
Thank you!!
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
is this the recursive form?
Yes:)
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?
And what is the algorithm for this gcd program, can u please tell me.
Euclid's algorithm :)
Thank you
thanks
Welcome :)
How the program runs without using loop
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.
How to find LCM and HCF by python
*I don't know ur name but tq yaar 💝💝*
Pleasure :)
My name is Amulya.
We didn't get output for this program
Give a detail information about merge sort sister
Sure:)
Thq sis