Invalid syntax in square equation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Invalid syntax in square equation

Please help me, I can't find a mistake. The console says there's a mistake in x2, but I can't understand where exactly. https://code.sololearn.com/cKROc6w2NaHD/?ref=app

21st Oct 2018, 12:34 PM
Александр Исайчев
4 Answers
+ 5
from math import sqrt a = int(input()) b = int(input()) c = int(input()) D = (b ** 2) - (4*a*c) if D == 0: print(-(b / (2*a))) elif D > 0: x1 = -((b - sqrt(D)) / (a*2)) x2 = -((b + sqrt(D)) / (a*2)) print(x1, x2)
21st Oct 2018, 12:46 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
The keyword 'continue' is only used in loops to skip to the next iteration. You might have been looking for the keyword 'pass'.
21st Oct 2018, 12:49 PM
jtrh
jtrh - avatar
+ 3
Your x1 = ... and x2 = ... lines are missing a close-parenthesis ‘)’ at the end of each line.
21st Oct 2018, 12:42 PM
Russ
Russ - avatar
+ 2
thank all of you, dear friends, now it works:)
21st Oct 2018, 1:01 PM
Александр Исайчев