+ 1
(edited) I want the code to choose 2 numbers such that their product is 4 and sum is 3
cdd = range(12) for i in cdd: for j in cdd: if i*j == 4 and i+j == 3: print(i,j)
3 Antworten
+ 4
i don’t think that this equation is possible
i + j=3
i=3-j
i*j=4
j(3-j)= 4 (substituting the value of j)
3j-j^2=4
j^2-3j+4=0
here, b^2 - 4ac is negative so this equation doesn’t have any real solution
+ 1
what output do you want?
0
Look at it as attempt to solve the quadratic equation (x^2)+3x+4=0