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
snow_lady [41]
3 years ago
7

11.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that returns the largest magnitude v

alue. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the function returns: 7 Ex: If the inputs are: -8 -2 the function returns: -8 Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the built-in absolute value function to determine the max magnitude, but you must still output the input number (Ex: Output -8, not 8). Your program must define and call the following function: def max_magnitude(user_val1, user_val2)

Computers and Technology
1 answer:
AlekseyPX3 years ago
3 0

Answer:

# the user is prompt to enter first value

user_val1 = int(input("Enter first value: "))

# the user is prompt to enter second value

user_val2 = int(input("Enter second value: "))

# max_magnitude function is defined

# it takes two parameters

def max_magnitude(user_val1, user_val2):

# if statement to compare the values

# it compare the absolute value of each

if(abs(user_val2) > abs(user_val1)):

return user_val2

elif (abs(user_val1) > abs(user_val2)):

return user_val1

# max_magnitude is called with the

# inputted value as parameter

print(max_magnitude(user_val1, user_val2))

Explanation:

The code is written in Python and well commented. A sample image of program output is attached.

You might be interested in
True or False: You should only use your mirrors to see behind you when parallel parking.
mafiozo [28]
False. You should always look /check ou tall mirrors periodicly
8 0
3 years ago
Read 2 more answers
Choose all that apply.
kirill115 [55]

Answer:

Bullets can be turned off and on.

Lists don't have to use numbers or bullets.

Explanation:

because L just wanted the light

6 0
3 years ago
Read 2 more answers
Identify the command on a local desktop CMD that will verify which group policies have been applied to the workstation. SELECT T
fomenos

Answer:

The answer is gpupdate

Explanation:

gpupdate command is used to update Group policies in Windows operating system Domain.

There are different options to use with the gpupdate but one of the most used option is the '/force' which will reapply all policy settings

8 0
3 years ago
In 1-2 sentences, describe some keyboard shortcuts you have used during this lesson to save you time.
Aneli [31]
Command C command V command A
5 0
3 years ago
Read 2 more answers
Help????????????1,2,3,4,5,6
Nana76 [90]

Answer: a, d, b

Explanation: trust

just did it

7 0
2 years ago
Other questions:
  • When troubleshooting firewalls, which of the following is not something you should do after you attempt a fix?
    7·1 answer
  • If a user on a laptop complains that they are unable to sign into windows even though they are certain they are entering the cor
    6·1 answer
  • Regarding the systems development​ process, ________ addresses the​ question, "Is the system producing the desired​ results?"
    12·1 answer
  • Todays hard drives give up to or more than 1000gb of space. true or false
    6·1 answer
  • A tax return preparer, routinely publishes a schedule of the fees she charges her clients. For how long must keep copies of the
    7·1 answer
  • (Bible)<br> Sin may be an inward thought or an outward act. True False
    11·2 answers
  • Is number 1 correct​
    7·2 answers
  • Value of 3.0+4.0×6.0​
    14·1 answer
  • Write a function, AvgList, that takes a single argument, a list, and returns the average (mean) of the numbers in the list. You
    10·1 answer
  • You are about to repair and change the resistor (small components),but the components are too small to solder and hold,what tool
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!