Answer question 2 thank you for 2Write a script file that su


Answer question #2 thank you for

2-Write a script file that subtracts the numbers passed to it as arguments on the command Ine and dhgys the results. For example, if you name this program suB, and you type (0%) SSUB 20 10 The program displays the following 20-10 10 Rewrite the sum program, and this time multiply the first and second argumen. For example, f you tyo S MUL 10 20 The program displays the following $MUL 10 * 20 = 200

Solution

SUB.py

#!/usr/bin/python
import sys
diff=sys.argv[0]-sys.argv[1]
print sys.argv[0],\' - \',sys.argv[1],\' = \',diff

MUL.py

#!/usr/bin/python
import sys
pro=sys.argv[0]*sys.argv[1]
print sys.argv[0],\' * \',sys.argv[1],\' = \',pro

 Answer question #2 thank you for 2-Write a script file that subtracts the numbers passed to it as arguments on the command Ine and dhgys the results. For examp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site