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
GarryVolchara [31]
3 years ago
13

Assume you want to write a code to calculate the addition of two numbers digit by digit. Provide the running time for your algor

ithm, assuming the inputs are two n-digit numbers. Explain your answer
Computers and Technology
1 answer:
Sergio039 [100]3 years ago
5 0

Answer:

Explanation:

Using Python programming language

Explanation:

1. I defined a function add and passed in two parameters (a,b).

2. In the block of the function, I added the two numbers and printed the result.

3. I decided to use a function so that the program is re-usable and can accept various inputs.

Find the code below. (# are used for comments)

#Addition of numbers

def add(a,b):

   print(a+b)

#Test Cases

add(2,4.5)      #Result=6.5

add(10,290)     #Result=300

add(2.567,4.58) #Result=7.147

You might be interested in
In an era of widespread cultural change within the United States,
Romashka [77]

In an era of widespread cultural change within the United States, members of the mainstream culture must learn the customs and practices of minority  groups, including new immigrants, and take care to avoid giving offense.  cultural norms of minority groups are so similar to those of the mainstream culture, that  knowing the norms of the majority is sufficient for business success.

Explanation:

  • Acculturation can be defined as the 'process of learning and incorporating the values, beliefs, language, customs and mannerisms of the new country immigrants and their families are living in, including behaviors that affect health such as dietary habits, activity levels and substance use.
  • A cultural misunderstanding occurs when something a word, gesture, object, social context, has different meanings in two cultures.
  • Sometimes the misunderstandings get resolved, sometimes they lead nowhere, and sometimes they can escalate to anything from love to war
  • Ethnic traditions as a sociocultural phenomenon allowing to comprehend the national identity of peoples and universal norms in each culture which make a methodological basis for formation of moral values.
  • But in the 1990s, the term minority usually refers to four major racial and ethnic groups: African Americans, American Indians and Alaska Natives, Asians and Pacific Islanders, and Hispanics.

4 0
4 years ago
What will be the output of “AAAAMMMMMHHHVV” using a file compression technique?
jeka94

Answer:

it would be amhv i think i hope it answered u'er question

Explanation:

8 0
4 years ago
It is important to ____ the line in the code editing window in the exact location where you want to insert a code snippet to pro
stepan [7]

Answer:

right -click

Explanation:

<h2><u>Fill in the blanks </u></h2>

It is important to <u>right - click</u>  the line in the code editing window in the exact location where you want to insert a code snippet to produce the shortcut menu with the Insert Snippet command.

8 0
3 years ago
In an array, we can swap the elements at any two indices in a single operation called a move. For example, if our array is a = {
quester [9]

Answer:

function moves(a) {

   var left = 0;

   var right = a.length-1;

   var count = 0;

   while (left < right) {

       if(a[left] % 2 == 0) {

           left++;

           continue;

       }

       if(a[right] % 2 == 1) {

           right--;

           continue;

       }

       var temp = a[left];

       a[left] = a[right];

       a[right] = temp;

       left++;

       right--;

       count++;

   }

   return count;

}

var a = [4,13,10,21,20];

console.log('Number of moves: ' + moves(a));

console.log('Sorted array: ' + a);

Explanation:

3 0
3 years ago
Previously, our password was 8 characters and included only lower-case letters. Now, because of changing requirements, we genera
BARSIC [14]

Answer:

7 characters.

Explanation:

Here we have 26(small letters)+26(capital letters)+10(number from 0-9)=62

As we are having more number of possibilities for each character of the password, We will need a smaller length to reach the same or better level of security.

If we take 6 characters long password we will have 626 = 56,800,235,584‬ possibilities, which is less secure than the previous 8 characters long password.

But if we take 7 characters long password we will have 627 = 3,521,614,606,208 possibilities, which is almost 17 times larger than the previous password and has a smaller length when compared to the previous password.

3 0
3 years ago
Other questions:
  • Describe a situation where it would be advantageous to use the copper tape or aluminum foil instead of the A and B push buttons
    7·2 answers
  • A(n) _______________ supplies one of the most critical aspects of docking stations, but in a smaller, more portable format: supp
    15·1 answer
  • Which of the following applies to a DNS caching server? (Choose all that apply.)
    6·1 answer
  • Is social media and advancement of technology causing our society to become less social?
    13·1 answer
  • In Microsoft Excel, you have a large dataset that will print on several pages. You want to ensure that related records print on
    13·1 answer
  • Which statement about images is correct? A) A virtual image cannot be formed on a screen. B) A virtual image cannot be viewed by
    12·1 answer
  • Do You assign the Needs Met rating before assigning the page quality (PQ) rating?
    11·1 answer
  • How many miss Dragon Ball Abridged?
    5·2 answers
  • Variable index has a value of 4, and variable accessValid has a value of False. What value does variable, accessPoints, have aft
    7·1 answer
  • List out any four hardware and software components required for multimedia​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!