also
print(f"{(3**2 + 5**2)**(1/3) = }")
output:
(3**2 + 5**2)**(1/3) = 3.239611801277483
doubling Jerrybibo's comment that generally eval is evil!
(and thanks for mentioning about not eval()
'ing an input) if you need to reuse the string of b_equation
and / or the result b
, then eval()
seems legit
b_equation = "(3**2 + 5**2)**(1/3)"
b = eval(b_equation)
print(f"{b_equation} = {b}")
# use b_equation and / or b for stuff