Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions