Math domain error

I am wrote code and i am had an a error, "Math domain error", why? How to fix it? https://code.sololearn.com/cU7NtZgaY2d2/?ref=app

24th Mar 2022, 8:35 AM
1 Answer
+ 1
it's because : list.append(num-i) will result in negative numbers num2 is negative by the last assignment, math.sqrt(num2) is a complex number.
24th Mar 2022, 8:48 AM
Bahha🐧 - avatar