Computer Science
Why is from import* statement not recommended for importing Python modules in an external program?
Python Modules
1 Like
Answer
Using from module_name import * is not recommended because it can lead to namespace pollution, reduce code readability, introduce unnecessary imports, and increase the risk of errors due to unintended or conflicting names.
Answered By
3 Likes
Related Questions
Out of random() and randint(), which function should we use to generate random numbers between 1 and 5. Justify.
What is the difference between import statement and from import statement?
Write a function to calculate volume of a box with appropriate default values for its parameters. Your function should have the following input parameters :
(a) length of box ;
(b) width of box ;
(c) height of box.
Test it by writing complete program to invoke it.
Consider the amount of donations received by a charitable organization given as under:
donations = [100, 60, 70, 900, 100, 200, 500, 500, 503, 600, 1000, 1200]
Now write a Python program to calculate the average amount obtained and median of the above data.