0

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))

1st Jul 2017, 8:58 AM
Trung ND
Trung ND - avatar
1 Answer
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?
1st Jul 2017, 9:39 AM
Sapphire