Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python

Please is there a way I can automate this in python? Let's say I have something like this : b = sqrt(b2 - 4a) / 2a If there's a way I can represent this in dictionary like this : (b, {sqrt:{div:{sub:{pow:{b, 2},mul:{4,a}}}},mul:{4,a}}) If there's a way to loop through the equation and get it in this dictionary format

1st May 2021, 1:34 AM
Abdullah
3 Answers
+ 1
#Yeah Why not px = input() #equation in format ax²+bx+c a,b,c = px.split("+") #spliting at every + a,b,c = map(int,(a[:-1],b[:-1],c)) #converting numbers to int values = {} values["b"] = pow(b**2 - 4*a*c,0.5)/2*a print(values) #Hope It Helps You 😊
1st May 2021, 6:36 AM
Hacker Badshah
Hacker Badshah - avatar
0
What if I just want to simplify the alphabet like without using integers
1st May 2021, 7:13 AM
Abdullah
0
Abdullah Sorry ,I didn't get you Can you explain what you are talking to do
1st May 2021, 8:36 AM
Hacker Badshah
Hacker Badshah - avatar