Q. Explain the difference between import <module> and from <module> import statements, with examples.
Answer =
import <module> statement, import the given module.
while from <module> import statement import the function which is present in given module.
Example :-
(i)
import math a = 144 print( math.sqrt(a) )
Output :-
12.0
>>>
(ii)
from math import sqrt as sq a = 144 print( sq(a) )
Output:-
12.0
>>>
Please also post the examples
ReplyDeleteyes please
DeleteOk : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )