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
Whats the relationship between the CPU and motherboard
Mashcka [7]

Answer:

Both perform processes vital to running the computer's operating system and programs -- the motherboard serves as a base connecting all of the computer's components, while the CPU performs the actual data processing and computing.

Explanation:

6 0
3 years ago
An ftp ____ is a computer that allows users to upload and/or download files using ftp.
Brums [2.3K]
<span>An ftp server is a computer that allows users to upload and/or download files using ftp.</span>
7 0
3 years ago
What is the memory of a computer called
Nataliya [291]
It is called Ram in another term for memory :)
6 0
3 years ago
Read 2 more answers
What does this say in morse code?
Furkat [3]

Answer:

That it is time for lunch?

Explanation:

4 0
3 years ago
Read 2 more answers
In order to consolidate your theoretical knowledge into technique and skills with practical and applicational value, you will us
Arisa [49]

Answer:

Check the explanation

Explanation:

Lasso: R example

To run Lasso Regression you can re-use the glmnet() function, but with the alpha parameter set to 1.

# Perform 10-fold cross-validation to select lambda --------------------------- lambdas_to_try <- 10^seq(-3, 5, length.out = 100) # Setting alpha = 1 implements lasso regression lasso_cv <- cv.glmnet(X, y, alpha = 1, lambda = lambdas_to_try, standardize = TRUE, nfolds = 10) # Plot cross-validation results plot(lasso_cv)

Best cross-validated lambda lambda_cv <- lasso_cv$lambda.min # Fit final model, get its sum of squared residuals and multiple R-squared model_cv <- glmnet(X, y, alpha = 1, lambda = lambda_cv, standardize = TRUE) y_hat_cv <- predict(model_cv, X) ssr_cv <- t(y - y_hat_cv) %*% (y - y_hat_cv) rsq_lasso_cv <- cor(y, y_hat_cv)^2 # See how increasing lambda shrinks the coefficients -------------------------- # Each line shows coefficients for one variables, for different lambdas. # The higher the lambda, the more the coefficients are shrinked towards zero. res <- glmnet(X, y, alpha = 1, lambda = lambdas_to_try, standardize = FALSE) plot(res, xvar = "lambda") legend("bottomright", lwd = 1, col = 1:6, legend = colnames(X), cex = .7)

Kindly check the Image below.

5 0
2 years ago
Other questions:
  • . Dеclarе a onе-dimеnsional array of 30 doublеs (on thе stack) namеd rainfall
    11·1 answer
  • ________ is a password-cracking method wherein the attacker compares passwords to lists of common words.
    12·1 answer
  • Is it just me or is brainly not working right now? I am trying to add friends and it won't let me!
    5·2 answers
  • If you're unsure of what chart to use for a set of data, what feature does Excel include that will help you to decide?
    7·1 answer
  • Retype and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks.
    9·1 answer
  • Can you be my friend plz
    9·1 answer
  • Why computer manufacturers constantly releasing faster computers ?
    14·1 answer
  • Please help it’s timed
    13·1 answer
  • Upload your completed project including the following:
    13·1 answer
  • What is output?<br> x = 2<br> y = 3<br> print (x * y + 2)<br> 4<br> 2<br> 8<br> 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!