subject

6.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. 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

Import Math
#TODO # Can't get it to output the expected output something is missing from this code
def max_magnitude(user_val1, user_val2):
if abs(user_val1) > abs(user_val2):
return user_val1
else:
return user_val2

if __name__ == '__main__':
n1 = int(input(""))
n2 = int(input(""))
print(max_magnitude(n1, n2))
math

EXPECTED OUTPUT:
1: Compare output
keyboard_arrow_up
1 / 1 (Only earned 1 point for this code out of 10 points)
Input
5
7
Your output
7
2: Unit test
keyboard_arrow_up
0 / 3 (these are the point we are to earn which is 0 because of the wrong output)
max_magnitude(5, 7)
3: Unit test
keyboard_arrow_up
0 / 3
max_magnitude(-8, -2)
4: Unit test
keyboard_arrow_up
0 / 3
max_magnitude(25, -50)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:00
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
This assignment continues work on the online booking facility introduced at the end of chapter- 10. the work will be continued in the assignments for chapters 14 and 15 (a) assume that you will produce your online booking facility using an agile approach. i. suggest the kind of user research you would like to conduct for your product before iteration cycles begin. ii prioritize the requirements for your product according to business value, i.e which requirements are likely to provide the greatest business benefit, and sketch out the ux design work you would expect to undertake during the first four iteration cycles, i.e. cycle 0, and cycles 1 to 3. (b) using one of the mockup tools introduced above, generate a mockup of your product's landing page, as developed in the assignment for chapter-11 (c) using one of the patterns websites listed previously, identify suitable interaction patterns for elements of your product, and develop a software-based prototype that incorporates all the feedback and the results of the user experience mapping achieved at the end of chapter-11. if you do not have experience in using any of these, create a few html web pages to represent the basic structure of your website
Answers: 2
question
Computers and Technology, 25.06.2019 04:00
Plz there is a problem with my account. i no longer have ! ( hand,ambitious,virtuoso etc.) it's like getting brainliest means nothing. how do i get ranks back?
Answers: 1
You know the right answer?
6.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that ret...
Questions
question
Mathematics, 02.08.2019 17:00
question
Mathematics, 02.08.2019 17:00
Questions on the website: 13722361