We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e5ece8 commit 6f8f4d5Copy full SHA for 6f8f4d5
__init__.py
__name__/__init__.py
__name__/main.py
@@ -0,0 +1,11 @@
1
+"""Test my_module import."""
2
+
3
+from my_module import fact
4
5
+if __name__ == "__main__":
6
+ print("Main module is executed.")
7
+ n = int(input("Enter n: "))
8
+ print(f"Factorial of {n} is {fact(n)}.")
9
+else:
10
+ print("Main module is imported.")
11
+ print(type(__name__), __name__)
__name__/my_module.py
@@ -0,0 +1,15 @@
+"""Any module."""
+def fact(n: int) -> int:
+ """Get the factorial of n."""
+ return n if n < 2 else n * fact(n - 1)
+ print("Lib module is executed.")
12
13
14
+ print("Lib module is imported.")
15
0 commit comments