Question: #Python Can anyone help me with this please Write a script named times.py that finds the product of two input integers and prints the results.

#Python

Can anyone help me with this please

Write a script named times.py that finds the product of two input integers and prints the results. Start by opening add_version2.py, modifying the last two lines and saving the file with the name times.py. An asterisk is used as the multiplication operator in Python, so youll use c = a * b to multiply. Also change the comment on line 1 to reflect the modified functionality. Run the script using two integer arguments to check that it works. The example below shows the expected behavior.

Check your results against this example.

Example input: 2 3

Example output: >>>

The product is 6.

CODE FROM version2.py

# add_version2.py adds two numbers given as arguments.

import sys # Now the script can use the built-in Python system module.

# sys.argv is the system argument vector. # int changes the input to an integer number. a = int(sys.argv[1]) b = int(sys.argv[2])

c = a + b # format(c) substitutes the value of c for {0} in the print statement. print 'The sum is {0}.'.format(c)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!