解一元二次方程(Python语言)

别妄想泡我
848次浏览
2020年07月29日 00:32
最佳经验
本文由作者推荐

树拼音-先公后私

>>> #
>>> import math
>>> def main():
print("This program finds the solutions to a quadratic.
")
try:
a,b,c=eval(input("Please enter the coefficients (a,b,c):"))
discRoot=(b*b-4*a*c)
root1=(-b+disRoot)/(2*a)
root2(-b-discRoot)/(2*a)
print("
Rhe solutions are:",root1,root2)
except ValueError as excObj:
if str(excObj)=="math domain error":
print("No Real Roots.")
else:
print("You didn't give me the right numbers.")
except NameError:
print("
You didn't enter three numbers.")
except TypeError:
print("
Your inputs were not all numbers.")
except SyntaxError:
print("
Your input was not in the correct form.")
except:
print("
Something went wrong,Sorry!")
main()

名词作定语-德馨的意思


鲜矣仁-凝的拼音


沙哑的反义词-潜意识是什么意思


hb是什么-举直错枉


中横线-蚌蛤


书塾的意思-刚的拼音


diyu-引人


形容担心的词语-孤鸿寡鹄