Kvadratic - Python

Run Settings
LanguagePython
Language Version
Run Command
import math def kvadratic(a, b, c): disc = discrim(a, b, c) if disc > 0: return two_roots(a, b, disc) elif disc == 0: return one_root(a, b) else: return "Diskriminant je zaporny, zadne realne koreny." def discrim(a, b, c): return b ** 2 - 4 * a * c def two_roots(a, b, disc): root1 = (-b + math.sqrt(disc)) / (2 * a) root2 = (-b - math.sqrt(disc)) / (2 * a) return (root1, root2) def one_root(a, b): return (-b / (2 * a),) result = kvadratic(2, 6, -20) print(result)
Editor Settings
Theme
Key bindings
Full width
Lines