I have written this code in sublime text
if intentos<3:
solution= math.sqrt(number)
print("La raiz cuadrada de " + str(number) + "es" + str(solution))
Then I have used sublimeREPL and I don't know why but It has appear this:
Traceback (most recent call last):
File "prueba.py", line 23, in <module>
solution= math.sqrt(number)
NameError: name 'math' is not defined
This error only appears when I use math.sqrt and I don not understand why. Moreover, I have copied this exact code from a video tutorial and he does the same as me but for some reason his sublimeREPL works correctly.
It gives the error
name 'math' is not definedbecause you haven't definedmath.You need to import it using:
at the start of the program.
Read more in the documentation