1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Readme [11.4K]
3 years ago
13

We will pass in 2 values, X and Y. You should calculate XY XY and output only the final result. You will probably know that XY X

Y can be calculated as X times itself Y times. # Get X and Y from the command line:import sysX= int(sys.argv[1])Y= int(sys.argv[2])# Your code goes here
Computers and Technology
1 answer:
kiruha [24]3 years ago
5 0

Answer:

import sys

# The value of the second argument is assigned to X

x = int(sys.argv[1])

# The value of the third argument is assigned to Y

y = int(sys.argv[2])

# The result of multiplication of x and y is assigned to 'result'

result = x * y

#The value of the result is displayed to the user

print("The result of multiplying ", x, "and ", y, "is", result)

Explanation:

First we import sys which allow us to read the argument passed when running the program. The argument is number starting from index 0; the name of the python file been executed is sys.argv[0] which is the first argument. The second argument is sys.argv[1] and the third argument is sys.argv[2].

The attached file is named multplyxy (it wasn't  saved as py file because the platform doesn't recognise py file); we can execute it by running: python3 multiplyxy.py 10 23

where x will be 10 and y will be 23.

To run the attached file; it content must be saved as a py file: multiplyxy.py

Download pdf
You might be interested in
A program is required to three (3) numbers. calculate and print their total
podryga [215]

A program that is required to three (3) numbers. calculate and print their total is given below:

<h3>The Program</h3>

import java.util.Scanner;

public class SumAndAverage {

public static void main(String[ ] args) {

System.out.println("Enter three numbers - ");

// Accepting and finding sum of numbers.

int sum = 0;

Scanner sc = new Scanner(System.in);

for (int i = 0; i < 3; i++)

sum += sc.nextInt( );

// Printing sum and average.

System.out.println("Sum - " + sum);

System.out.println("Average - " + (sum / 3f));

}

}

The output would request three different numbers, then add them up, and display the output of the sum and then display or print their total


Read more about programming here:

brainly.com/question/23275071

#SPJ1

5 0
1 year ago
How to deactivate the brainly app?​
galina1969 [7]

Answer:

Don't you just uninstall it?

Explanation:

5 0
3 years ago
Read 2 more answers
How can edge computing be used to increase sustainability
nika2105 [10]

Edge computing be used to increase sustainability With Edge Computing the number of records traversing the network can be reduced greatly, freeing up bandwidth.

<h3>How is part computing sustainable?</h3>

Data centers devour an expected 2 hundred terawatt-hours (TWh) of power every year–extra than the power intake of a few countries. They additionally produce an expected 2% of all worldwide CO2 emissions. Edge Computing reduces network site visitors and records centre usage.

Data centres devour an expected 200 terawatt-hours (TWh) of power every year–extra than the power intake of a few countries. They additionally produce an expected 2% of all worldwide CO2 emissions.

Read more about the sustainability:

brainly.com/question/25350238

#SPJ1

4 0
2 years ago
Enzymes_____________.
lord [1]

Answer:

b. speed up chemical reactions.

Explanation:

brainly plz

4 0
3 years ago
A student is having trouble finding enough time in his busy schedule to work on his school science project. He has a demanding s
Katena32 [7]

Answer:c

Explanation:

got it rii

3 0
3 years ago
Read 2 more answers
Other questions:
  • Workspace How do the following technologies help you in your quest to become a digital citizen: kiosks, enterprise computing, na
    6·1 answer
  • Typohunting is registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes
    5·1 answer
  • The underline format will underline ____.
    14·1 answer
  • : How does the founder of Wikipedia keep a tight reign on accuracy? HELP PLEZ AT LEAST A PARGRAPH PLES
    6·1 answer
  • 3.24 LAB: Seasons
    13·1 answer
  • Mac or PC (need opinions please)<br><br> Why did you choose Mac/PC?
    10·2 answers
  • How can the use of new technology in industry benefit the us government
    8·2 answers
  • Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smalle
    11·1 answer
  • David would like to send a letter to more than one hundred people. He would like the letter to have names and addresses inserted
    12·2 answers
  • You defined a class and saved it as shoe.py.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!