¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
If you already "from module import function as aliias" don't try to use function name
from math import sqrt as square_root print(square_root(100)) print(sqrt(100)) Will cause error from math import sqrt as square_root print(square_root(100)) print(sqrt(100))
1 Respuesta
0
It does not cause any error that I'm aware of.
from math import sqrt as square_root
print(square_root(16))
# Output: 4.0
The only error I'll see is your attempt to use the 'sqrt' as a function, but that doesn't exist, since it is under the variable name 'square_root".
If you're planning on using more than one function from a module, it is better to just import the whole thing. Otherwise, I'm not sure what error you're talking about?