vikash-python-library 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
def add(numbers):
|
|
4
|
+
return sum(numbers)
|
|
5
|
+
|
|
6
|
+
def multiply(numbers):
|
|
7
|
+
result = 1
|
|
8
|
+
for num in numbers:
|
|
9
|
+
result *= num
|
|
10
|
+
return result
|
|
11
|
+
|
|
12
|
+
def main():
|
|
13
|
+
parser = argparse.ArgumentParser()
|
|
14
|
+
|
|
15
|
+
parser.add_argument(
|
|
16
|
+
"operation",
|
|
17
|
+
choices=["add", "multiply"]
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
parser.add_argument(
|
|
21
|
+
"numbers",
|
|
22
|
+
nargs="+",
|
|
23
|
+
type=float
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
my_arg = parser.parse_args()
|
|
27
|
+
|
|
28
|
+
if my_arg.operation == "add":
|
|
29
|
+
result = add(my_arg.numbers)
|
|
30
|
+
|
|
31
|
+
elif my_arg.operation == "multiply":
|
|
32
|
+
result = multiply(my_arg.numbers)
|
|
33
|
+
|
|
34
|
+
return result
|
|
35
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
vikash_python_library/__init__.py,sha256=Zk_m80Hm6fhTYZXz3JLBPB-gBkdamo5BfvAy-kfEgTk,602
|
|
2
|
+
vikash_python_library-0.1.0.dist-info/WHEEL,sha256=8ZlpUMJ7mlDirmlHRhDirEx_nPnARrwDjeE92mlk68E,81
|
|
3
|
+
vikash_python_library-0.1.0.dist-info/entry_points.txt,sha256=gt9DwwRR1hHpCLWpM4fHqoxMS-MODeP2iuypoUsSmwM,56
|
|
4
|
+
vikash_python_library-0.1.0.dist-info/METADATA,sha256=X8pkoGcfyBUjS2WVTTcAuYYVHi8V03BZM_jADM-8Irk,246
|
|
5
|
+
vikash_python_library-0.1.0.dist-info/RECORD,,
|