Question: In Python If input 1 and input 2 have the same parents, result = 0 Else if input 1 and input 2 have the same
In Python
If input 1 and input 2 have the same parents, result = 0
Else if input 1 and input 2 have the same grandparents, result = 1
Else if input 1 and input 2 have same g_grandparents , result = 2
Else if input 1 and input 2 have same g_g_grandparents , result = 3
Continue until found they have the same g_g_g._grandparents,
For adding one g, result +1
Else if no relationship between two inputs, result = -1
tree = [[Max, None , None],
[Luc, Max, None],
[Lue, Max, None],
[Joy, Luc, Yoyo],
[Geo, Joy, Zoe,],
[Julie, Geo, Eva],
[input1, Brand, Julie],
[Jim, Lue, Rae],
[Gil, Jim, Ree],
[Rose, Gil, Mandy]
[input2, James, Rose]
this followed by [people, father, mother]
degree(input1, input2, tree)
4 Write the function degree(input1, input2, tree) 
Max Rae Yoyo Luc Lue Zoe Ree Joy Jim Mandy Ana Geo Eva Boo Gil Julie James Rose Brand Input1 Input2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
