Discuss / Python / 交作业

交作业

Topic source

小菘Barry

#1 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

import math

def quadratic(a, b, c): minus = b 2 - 4 a c if minus >= 0:
x1 = ((-b + (math.sqrt(b
2 - 4 a c))) / (2 a)) x2 = ((-b - (math.sqrt(b b - 4 a c))) / (2 a)) return x1, x2 else: print("You need to make\ 'b ** 2 - 4 a * c' greater than\ or equal to 0") result = quadratic(int(input('1st parameter: ')),\ int(input('2nd parameter: ')),\ int(input('3rd parameter: '))) print(result)


  • 1

Reply