+ 5

Is this code valid? Why?

import math as myth print(math.pow(0,2))

5th Mar 2020, 3:16 AM
APC (Inactive for a while)
APC (Inactive for a while) - avatar
1 Respuesta
+ 8
math will not be defined since you imported it as myth. You have given a name to math module that is myth and you have to type myth to call it instead of math or it will not work. I think you might know but by doing import math as myth you have just changed the name of how you call the math function. so instead of math.ceil() or math.pow() etc. it will be myth.ceil() and myth.pow() etc. Except that, your code myth.pow(0,2) will give 0.0 as an output. as 0**2 will be zero.
5th Mar 2020, 3:22 AM
Utkarsh Sharma
Utkarsh Sharma - avatar