Feb-29-2020, 10:09 AM
Hi, ndc85430
Name of the script is ScriptEnv.py
Created another script with the name ScriptEnv2.py to call this main ScriptEnv.py
Thanks.
Name of the script is ScriptEnv.py
from math import pi def circle_area(r): return pi * (r ** 2) def circle_circumference(r): return 2 * pi * r radius = float(input("Enter radius: ")) print("Area =", circle_area(radius)) print("Circumference =", circle_circumference(radius)) def main(): print("Running the main function") if __name__ == "__main__": main()This works.
Created another script with the name ScriptEnv2.py to call this main ScriptEnv.py
import ScriptEnv ScriptEnv.circle_area() ScriptEnv.circle_circumference()
Output:>>> %Debug ScriptEnv2.py
Enter radius: 2
Area = 12.566370614359172
Circumference = 12.566370614359172
Traceback (most recent call last):
File "E:\Python\Thony_Scripts\ScriptEnv2.py", line 3, in <module>
ScriptEnv.circle_area()
TypeError: circle_area() missing 1 required positional argument: 'r'
The second script should not display anything but it's giving Area and Circumference and 1 error. Thanks.