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:57the function returns:7Ex: If the inputs are:-8-2the function returns:-8

Answers

Answer 1

I wrote my code in python 3.8:

def max_magnitude(num1, num2):

   return num1 if abs(num1) > abs(num2) else num2

print(max_magnitude(-8,-2))

I hope this helps!


Related Questions

how has the Internet of Things affected business​

Answers

Internet of Things devices can be connected to each other and controlled to improve efficiency,which in turn has direct effects on the productivity of the business. Hope this helps!

Answer:

Business equipment can be continually adjusted based on analysis of data

Explanation:

A P E X

Input an int greater than 0 and print every multiple of 5 between it and 0 inclusive in descending order. If the number is not greater than 0 print "error". Print all numbers on one line with single spaces in between.
Example:
Enter a positive integer:
42
40 35 30 25 20 15 10 5 0

Answers

import java.util.Scanner;

public class JavaApplication42 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a positive integer:");

       int num = scan.nextInt();

       if (num < 0){

           System.out.println("error");

       }

       else{

           while(num >=0){

               if (num %5 == 0){

                   System.out.print(num+" ");

               }

               num--;

           }

       }

   }

I hope this helps!

The program is an illustration of loops.

Loops are used to carry out repetition operations;

The program in Python, where comments are used to explain each line is as follows:

#This gets a positive integer from the user

num = int(input("Enter a positive integer: "))

#If the input is not greater than 0

if num <= 0:

   #This prints Error

   print("Error")

#If otherwise

else:

   #This iteration is repeated until 0 is printed

   while num>=0:

       #If the current number is a multiple of 5

       if num%5 == 0:

           #The number is printed

           print(num,end=" ")

       #This decreases the number by 1, until it gets to 0

       num-=1

The above program is implemented using a while loop

Read more about similar programs at:

https://brainly.com/question/20349503

The ball in the program was an instance of a sphere.

Which quantity do you change to move the ball?

vector

pos

radius

axis

Answers

Answer:

axis

Explanation:

i hop is correct don geve my 5 start in to is conform

Answer:

Pos

Explanation:

Edge2020

Help me! I’ll mark you brainly ! Please help me I need this now

Answers

Explanation: For number 3 I would say shade and darkness.

Someone help me for about how to avoid online scams please I need help no trolls

Answers

Answer:

1. (for emails) Block spam messages.

2. Look at who sent whatever it is and make sure it is the exact email for the brand.

3. If someone is putting a lot of emojis in a comment or somthing its fake.

4. Make sure to read the fine print.

5. Do not giveaway personal information like zip code, address, social security number.

Because all the IEEE WLAN features are isolated in the PHY and ____________ layers, practically any LAN application will run on a WLAN without any modification.

Answers

Answer:

MAC

Explanation:

MAC Layer is the acronym for Media Access Control Layer. This said Media Access Control Layer happens to be one of the two sublayers that comprises of the Data Link Layer of the OSI model. The Media Access Control layer is majorly responsible or in charge of moving various data packets to the Network Interface Card, and also from the Network Interface Card (NIC) across a particular shared channel. The Media Access Control sublayer and the logical link control sublayer together are what makes up the data link layer.

If a network card is configured to "obtain IP automatically," from where does it obtain its IP address? (What is the name of the service that assigns IP addresses?)

Answers

Answer:

It obtains the up adress from a service called DHCP. The DHCP server is usually located on a Router for home networks.

20 pts, please write in JAVA. need this ASAP
In the Lesson Slides for this activity, we developed a method findChar for figuring out if a character was in a String.

The implementation was:

public boolean findChar(String string, String key)
{
for(int index = 0; index < string.length(); index++)
{
String character = string.substring(index,index+1);
if(character.equals(key))
{
return true;
}
}
return false;
}
However, there is a much more efficient and simple algorithm that we can use to determine if a character is in a String. Using the method signature public boolean findChar(String string, String key), figure out a more efficient method with a lower exection count.

Hint: We’ve learned a couple of methods that can tell us what index a character is at - can we use those to determine if the character is in a String?

Answers

public class JavaApplication78 {

   public boolean findChar(String string, String key){

       if (string.contains(key)){

           return true;

       }

      return false;

   }

   public static void main(String[] args) {

       JavaApplication78 java = new JavaApplication78();

       System.out.println(java.findChar("hello", "h"));

   }

   

}

First I created the findChar method using the contains method. It checks to see if a certain sequence of characters is in another string. We returned the result. In our main method, we had to create a new instance of our main class so we could call our findChar method.

Write a sub that does the following:

a. it asks the user to input a word.
b. it enters each character of the word in order in consecutive cells in row 2, starting with cell C2.

Answers

Answer:

Explanation:

Using an Excel VBA string function to write the sub

Initially:

To loop from the last character back unto the first, we have to Offset in order to increase the column with each iteration of the for loop, as well as Mid$ just to return the characters one at a time.

Public Sub Question() Dim Word As String Dim Cnt As Integer Word = InputBox("Please Enter a word") For Cnt = Len(Word) To 1 Step -1 Range("C2").Offset(, Len(Word) - Cnt).Value = Mid$(Word, Cnt, 1) Next End Sub

Similarly, suppose we want to use StrReverse: Then; we can write it as;

Public Sub Question2() Dim Word As String Dim Cnt As Integer Word = InputBox("Please Enter a word") Word = StrReverse(Word) For Cnt = 1 To Len(Word) Range("C2").Offset(, Cnt - 1).Value = Mid$(Word, Cnt, 1) Next End Sub

Write a script that inputs a line of plaintext and a distance value and outputs an encrypted text using a Caesar cipher.
The script should work for any printable characters. An example of the program input and output is shown below:
Enter a message: Hello world!
Enter the distance value: 4
Output: Lipps${svph%

Answers

Answer:

def encrypt_text(text,value):

   encoded = ""

   for i in range(len(text)):

       char = text[i]

       if (char.isupper()):

           encoded += chr"po"ord'po'char'pc' + value -65'pc' % 26 + 65'pc'

       else:

           encoded += chr'po'ord'po'char'pc' + value -97'pc' % 26 + 97'pc'

   return encoded

plaintext = input("Enter sentence of encrypt: ")

dist_value = int(input("Enter number: "))

encrypted = encrypt_text(plaintext, dist_value)

print(encrypted)

Explanation:

The python program above is a Ceasar cipher implementation. The encrypt_text function is defined to accept text input and a distance value, which is used to encrypt the plaintext.

The user can directly input text and the distance value from the prompt and get the encrypted text printed on the screen.

Create a new program with a struct, Data, that contains: an int a char[80] Write a function newData(char[]), that takes char[] as a parameter

Answers

Answer:

#include <iostream>

#include <cstring>

using namespace std;

struct Data {

   int userId;

   char name[80];

}

void newData(string data char[]){

   int counts= 0;

   struct Data name;

   data.userId = ++counts;

   data.name = char[];

   cout<< data.userId << "\n"<< data.name ;

}

int main( ) {

   char myName;

   string mydata;

   cin>> myName;

   cin>> mydata;

   newData( myName, mydata);

}

Explanation:

The c++ source code above stores its data in a struct called "Data". The function newData dynamically creates new data from the struct defined.

Why would an information systems security practitioner want to see network traffic on both internal and external network traffic?

Answers

Answer:

To see who is accessing data and also where it is going

Explanation:

An information systems practitioner is a person who is involved in the planning and and also implementation of IT resources for any organization which he at she works.

The information systems practitioner would want to want to see network traffic on both internal and external network traffic so as to know who is accessing data and to also know where it is going.

Which statistical measurement tools should be
used to solve the problem? Check all of the boxes
that apply.
A coach wants to calculate the average test scores
of students who participate in the most popular
sport that the school offers.
mean
median
mode

Answers

Answer:

mean

mode

Explanation:

edg 2020

Answer:

MEAN

mode

Explanation:

This is my paragraph

. The type of color is ude in this code line is ..............................

Answers

What is the paragraph even supposed to be about

identify 5 products/services needed by the people in our current situation.

Answers

Answers with Explanations:

5 Products/Services Needed by People These Days.

1. Face mask/Surgical mask - The use of face mask is considered a common sense. Most countries mandate people to wear this every time they go out.

2. Food Delivery service - To prevent contracting corona virus, most people prefer to have their food delivered than to dine out. This increases the demand for the food delivery service.

3. Alcohol - It has become an important habit recently to disinfect hands and other things. This is also being advertised on TV, thus many people carry it along with them.

4. Infrared Forehead Thermometer - Many establishments use this in order to quickly check the temperature of people entering.

5. Internet service - The increase use of this service is due to online learning and remote-working situations.

We all need different product and services. In this pandemic time, the products/services needed by the people are;

Face mask or Surgical mask

All round Food Delivery service  

Humanitarian gestures by people or firms and also Good Tv programs that are educative and one can watch with kids them.

Infrared Forehead Thermometer  

Internet service

A product is known to be a tangible goods that one buys or acquisition,  consume, etc.  Service is known as an intangible item.

A key reason for any new development is to give the best or new value to the customer and in this present time. Helping those who have lost their jobs, having mask mask,  etc., readily available will go a long way to help.

Learn more about Products from

https://brainly.com/question/10873737

Write a logical expression using only and, or and not that is equivalent to the Exclusive NOR (XNOR) gate on 2 inputs, called in1, in2: If both inputs are True or both inputs are False (i.e. inputs have same value), then your expression should evaluate to True. Otherwise your expression should evaluate to False.

Answers

Answer:

in1 = int(input("Enter value one: "))

in2 = int(input("Enter value two: "))

print(in1,type(in1), in2, type(in2))

if (in1 <=0 and in2 <=0) or (not in1 <=0 and not in2<=0):

   print( True)

else:

   print( False)

Explanation:

The if statement of the python source code is used to implement an Exclusive-NOR logic gate that gives a true or high value if both inputs are either true or false.

Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total number of inches. Note: There are 12 inches in a foot.

Sample output with inputs: 5 8

Answers

I wrote my code in python 3.8:

def print_total_inches(num_feet, num_inches):

   return ((num_feet)*12) + num_inches

print("There are a total of {} inches".format(print_total_inches(5,8)))

I hope this helps!

The _______ within a story are the people and/or objects that the story is about

A. Timeline
B. Plot
C. Characters
D. Setting

Answers

Answer:

c

Explanation:

thats who the story and book is about

C characters lol :) it’s C

Using complete sentences post a detailed response to the following.

What are the advantages and disadvantages of top-down and bottom-up programming? How would you decide which one to use? Do you approach problems in your real life from a bottom-up or top-down approach?

Answers

Answer:

some advantages of top down is that you can start off from what you know and figure out what you need to complete it, advantages to bottom up is that you can make something new . if you are starting something from scratch and you dont know what the end goal might be you would use bottom up but if you already have an idea or the final product of what you want you would go the top down approach.

Explanation: just saying you shouldnt just copy and paste my response but rather pick out what you want to say and use this to complete what ever your working on. hope i helped :)

Answer:

the guy on top of me is super right follow him

Explanation:

Write a program in Python to sum to numbers:

Urgently needed, please.

Answers

num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: "))

print("{} + {} = {}".format(num1,num2,num1+num2))

Variables num1 and num2 prompt the user for a number. The print function then displays the answer and equation.

Sometimes young adults may want to experience physical intimacy, and their lack of knowledge may result in .

Answers

Answer:

Unexpected outcome: Sometimes young adults may want to experience physical intimacy, and their lack of knowledge may result in pregnancy. ... Parents may experience emotions of frustration and anger when they have to deal with a cranky or troublesome child.

Write a program to print the prime numbers from 500 to 700. The program should also print the count of prime numbers between 500 and 700. A number is called a prime number if it has exactly two positive divisors, 1 and the number itself. For example, the number 5 is prime as it has only two divisors: 1 and 5.

Answers

primes = 0

for x in range(500, 701):

   count = 1

   for w in range(2, x+1):

       if x % w == 0:

           count += 1

   if count < 3:

       print(x, end=" ")

       primes += 1

print("\nThere are {} prime numbers between 500 and 700".format(primes))

I hope this helps!

Which input value causes the loop body to execute a 2nd time, thus outputting "In loop" again? { String s = "Go"; while ((!s.equals("q"))&& (!s.equals("")) System.out.println("In loop"); 5 - scnr.nextO;
a) "Quit"
b) "q" only
c) "Q only
d) Either "q" or "Q"

Answers

Answer:

a) "Quit"  

c) "Q only

Explanation:

Given

String s = "Go";

while ((!s.equals("q"))&& (!s.equals("")))  {

System.out.println("In loop");

s = scnr.next();

}

Required

What input causes another execution

Analyzing the while condition

while ((!s.equals("q"))&& (!s.equals("")))  

This can be split into:

!s.equals("q")) && (!s.equals(""))

Meaning

When s is not equal to "q" and when s is not an empty string

In other words,

the loop will be executed when user input is not "q" and user input is not empty.

So, from the list of given options: The loop both will be executed when:

a) Input is "Quit"

c) Input is Q only

Input of q will terminate the loop, hence b and d are incorrect

Shrink-wrap, box-top, and click-wrap agreements are inherent to e-commerce. How you feel about them often depends on whether you are the vendor or purchaser. What are the best practices to assure shrink-wrap, box-top, and click-wrap agreements are legal? What are the best ethical practices that the e-commerce industry should adopt?

Answers

Answer:

Shrink-wrap, Box-top, and Click-wrap Agreements

a) The best practices to assure that shrink-wrap, box-top, and click-wrap agreements are legal include  

1) having e-commerce terms and conditions separate from the normal trade terms and conditions,  

2) ensuring that customers agree to the terms before entering into a transaction, and  

3) laying the code of conduct for all visitors interacting with your site or doing any business transaction on your site.

b) The best ethical practices that the e-commerce industry should adopt are:

1) Put additional layers of protection like a web application firewall to their websites.  

2) Ensure they always adhere to PCI (Payment Card Industry) compliance guidelines.

3) They should not store customers' data which they do not need.

4) Ensure privacy and security of customers' data.

5) Establish trust by safeguarding intellectual property rights.

6) Consider some environmental issues (customers care about them).

Explanation:

a) Websites' Terms and Conditions (T&C) establish some form of legal contract between the organization and its clients.  

b)To ensure that organizations that process, store, or transmit credit card information maintain secure online environment, they are required to comply with PCI DSS.  It is a set of Payment Card Industry requirements for all organizations involved in the use of online cards for payment for their goods and services.

Which term describes a visual object such as a picture a table or text box

Answers

the correct answer is “caption”

Answer: caption

Explanation:

Edge 2020

Write a method called rotate that moves the value at the front of a list of integers to the end of the list. For example, if a variable called list stores the values [8, 23, 19, 7, 45, 98, 102, 4], then the call of list.rotate(); should move the value 8 from the front of the list to the back of the list, changing the list to store [23, 19, 7, 45, 98, 102, 4, 8]. If the method is called for a list of 0 elements or 1 element, it should have no effect on the list. You may neither construct any new nodes to solve this problem nor change any of the data values stored in the nodes. You must solve the problem by rearranging the links of the list.

Answers

Answer:

Explanation:

public void rotate()

{

if(front == null)

return;

ListNode current = front;

ListNode firstNode = current;

while(current.next != null)

{

current = current.next;

}

current.next = front;

front = firstNode.next;

firstNode.next = null;

}

Write function that ask for input from a user. Use this input as input for the countdown function that we wrote using the while loop. If the user types 'end', the program exits, otherwise it keeps going.

Answers

Answer:

Written in Python:

def myfunction():

     userinput = input("User input: ")

     while(userinput != "end"):

           countdown(userinput)

           userinput = input("User input: ")

Explanation:

This line defines the function

def myfunction():

           This line prompts user for user input

           userinput = input("User input: ")

           The following while loop checks if userinput is not "end". It continues execution until user input "end"

           while(userinput != "end"):

                       countdown(userinput) If yes, the input is passed to the countdown function for execution

                       This line prompts user for another user input

                       userinput = input("User input: ")

Please note the above code segment assumes that countdown() function has already been written and defined

a rectangle is 12 cm long and 9 cm wide.Its perimeter is doubled when each of its sides is increased by a fixed length.what is the length?​

Answers

Answer:

length = 12 cm

breadth = 9 cm.

perimeter of rectangle = 2( l+b)

= 2(12+9) = 2(21) = 42cm.

New length = (12+x) cm

New breath = (9+x) cm

2(12+x+9+x) = 42×2

2(21+x) = 84

21+ x = 84/2

21+x = 42

x= 42-21= 21

x= 21.

Therefore, length = (12+x)cm

=( 12+21) cm = 33cm.

Explanation:

Firstly we have written the length and breadth of the rectangle.

And the perimeter of rectangle i.e. 2(l+b)

Then, as it is in question we have doubled the perimeter

And at last, we have got the value of x.

and by putting the value in the new length we will get our answer.

hope you have got your answer dear.

One of the primary principles of the Rapid Application Development methodology is early prototyping of the _______ in the development cycle

Answers

Answer:

Software Applications

Explanation:

Rapid Application Development (RAD) also is an agile project management strategy used in the development of software. RAD is also referred to as Rapid Application Building (RAB).

Its greatest advantage is that it reduces the time taken to churn out a program and this is why a lot of developers are now adopting it.

This is made possible by reducing the amount of time and effort spent on planning and increasing the amount of energy spent on creating prototypes.

Other merits of this methodology are:

It reduces the risk associated with the project by ensuring that the program is first used as a prototype rather than the real deal. It ensures better quality. When users interact with the prototypes, they are able to provide very useful feedback that goes back into development to enhance the quality of the project.

Cheers!

Test if a number grade is an A (greater than or equal to 90). If so, print "Great!".

Hint: Grades may be decimals.

in python

Answers

Answer:

yes great

Explanation: sorry but I'm a little confused

grade = float(input("Enter your grade: "))

if grade >= 90:

   print("Great!")

I hope this helps!

Other Questions
I am having trouble with this Who was the best boy band in the 90s? REMEMBER A function cannot have twodifferent outputs for the same input. Ithowever, have two different inputs for theDetermine whether each set of ordered pairs represents a function.2. {(-8,5), (-6, 4), (-2,4), (0, 2)1. {(0, 0), (2, 1), (4,2), (6,3)}3. {(-3,-4),(-3,-1),(-3,2), (-3,5)}same output.I need help with the 3 questions Rate at which wave travels or propagates PLZ HEEEELLLLLPPP!!!! 10 POINTS 4 MINSWhich sentence from part 1 of The Call of the Wild best supports the theme It is important to pick your battles?Thirty or forty huskies ran to the spot and surrounded the combatants in an intent and silent circle.Though his dignity was sorely hurt by thus being made a draught animal, he was too wise to rebel.Francois was stern, demanding instant obedience, and by virtue of his whip receiving instant obedience. . . .Dave, who was an experienced wheeler, nipped Buck's hind quarters whenever he was in error. The graph shows a line and two similar triangles.yWhich expression finds the equation of the line?Y What is the purpose of anaphase?A) to assist the DNA in forming proteins and chromosomesB) to promote the growth of new chromosomes within the cellC) to provide space within the cell for chromosomes to move aroundD) to ensure that each daughter cell gets a complete copy of the parents DNA The subtleof the newassignment was that I would becomplicationapplicationimplicationworking all weekend. What sank US transport ships? 9. Why did some parents support child labor? Can someone help me pleaseeeeAmdjjsisjshajsvdvd Why is solar energy considered a inexhaustible energy resource Cell division results in reproduction, growth, replacement and recycling of the organism. true or flase Multiply. Write your answer in scientific notation. Take a look at the picture! Which elements are among the six traits of academic writing? Check all that apply.ideasconventionspersuasionword choicesentence fluencythesis statements idk how to do math 3/4+(1/102/5) I am so stuck on this problem! I think I know what the answer is but I'm just not sure if I'm right. Can someone please help? _______ is the ability of a material to absorb energy and plastically deform without fracturing *HardnessStiffnessToughnessBrittleness PLEASE HELP IM TIMEDWhich of the following is not an oxidation-reduction reaction?Upper X e upper F subscript 6 (s) right arrow upper X e upper F subscript 4 (s) plus upper F subscript 2 (g).2 upper C s (s) plus upper I subscript 2 (g) right arrow 2 upper C s upper I (s).2 upper H subscript 2 upper S upper O subscript 4 (a q) plus 2 upper B a (upper O upper H) subscript 2 (a q) right arrow 2 upper B a upper S upper O subscript 4 upper H subscript 2 upper O (l).Upper Z n (s) lus 2 upper A g upper N upper O subscript 3 (a q) right arrow upper Z n (upper N upper O subscript 3) subscript 2 (a q) plus upper A g (s). How does this image reflect George Washington's views on government? (5 points)He believed in the importance of state sovereignty.He had a foreign policy that favored Great Britain.He did not believe presidents ought to have a third term.He believed the federal government needed more power.