Quick actions

cmd+k|ctrl+k

Navigation

Languages

quadratic_equation

Snippet info

Language

Python

Visibility

public

Author

c0kureaxxx17

Created

2020-12-28T02:50:42Z

Updated

2020-12-28T03:25:04Z


#2次方程式の解を求める

def solve(a, b, c):
    D = (b*b - 4*a*c)**0.5
    x_1 = (-b + D)/(2*a)
    x_2 = (-b - D)/(2*a)
    print('解は {0}, {1}'.format(x_1,x_2))
    
solve(1,1,-6)
INFO