Skip to content

Commit ab3a6f1

Browse files
author
Saxena, Ashwani
committed
update
1 parent 846c018 commit ab3a6f1

74 files changed

Lines changed: 816 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

0_first-script.py

100644100755
File mode changed.

0_helloworld copy 10.py

100644100755
File mode changed.

0_helloworld copy 11.py

100644100755
File mode changed.

0_helloworld copy 12.py

100644100755
File mode changed.

0_helloworld copy 13.py

100644100755
File mode changed.

0_helloworld copy 7.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0_helloworld copy 9.py

100644100755
File mode changed.

10_0_comandLine.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# python ./10_0_comandLine.py 1 2 3
2+
import sys
3+
4+
# total arguments
5+
n = len(sys.argv)
6+
print("Total arguments passed:", n)
7+
8+
# Print all command line arguments
9+
print("Arguments Passed:", sys.argv)
10+
11+
# Print the Script Name
12+
print("Script Name:", sys.argv[0])
13+
14+
# Print First Argument
15+
print("First Argument:", sys.argv[1])
16+
17+
# Print Second Argument
18+
print("Second Argument:", sys.argv[2])
19+
20+
# Print Third Argument
21+
print("Third Argument:", sys.argv[3])

10_1_comandLine.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# python ./10_1_comandLine.py 1 add 3
2+
# python ./10_1_comandLine.py 9 sub 3
3+
# python ./10_1_comandLine.py 6 mult 3
4+
import sys
5+
6+
num1 = int(sys.argv[1])
7+
operator = sys.argv[2]
8+
num2 = int(sys.argv[3])
9+
10+
if operator == 'add':
11+
output = num1 + num2
12+
print (output)
13+
elif operator == 'sub':
14+
output = num1 - num2
15+
print (output)
16+
elif operator == 'mult':
17+
output = num1 * num2
18+
print(output)
19+
else:
20+
print("Please give the correct operator, it is add, sub, multi")

11_function_0.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)