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
tia_tia [17]
3 years ago
7

Here we have a program which is calling the subtract function to calculate the difference between two numbers. The value from th

e subtract function is being stored in a variable called answer. Then answer is being displayed.
Code is not executing as expected. Instead of seeing the answer, we are seeing the word "None."
Modify the code within the subtract function so the value for solution is returned when the function is called. When you are finished, the output should Desired Output.

# Define the subtraction function
def subtraction(minuend, subtrahend):
solution = minuend-subtrahend
print(minuend,"minus",subtrahend,"equals",solution)

# Call the subtraction function
subtraction(4, 10)

desired output:

10 minus 4 equals 6
Computers and Technology
1 answer:
statuscvo [17]3 years ago
8 0

Answer:

See explanation

Explanation:

Given

The above program that subtracts two numbers and returns the result

Required

Modify the source code to run perfectly

When the given program is tested, it displays

<em>4 minus 10 equals -6 </em>

<em></em>

<em>Which is different from the expected output of</em>

<em>10 minus 4 equals 6 </em>

<em></em>

Modify

<em>solution = minuend-subtrahend </em>

<em>to</em>

<em>solution = subtrahend  - minuend</em>

<em></em>

And that does it.

You might be interested in
Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c
barxatty [35]

Answer:

#include <string>

#include <iostream>

using namespace std;

int main() {

string userInput;

getline(cin, userInput);

// Here, an integer variable is declared to find that the user entered string consist of word darn or not

int isPresent = userInput.find("darn");

if (isPresent > 0){

cout << "Censored" << endl;

// Solution starts here

else

{

cout << userInput << endl;

}

// End of solution

return 0;

}

// End of Program

The proposed solution added an else statement to the code

This will enable the program to print the userInput if userInput doesn't contain the word darn

6 0
3 years ago
Sometimes, fourth-generation languages (4GLs) are called procedural languages
irakobra [83]
Hi!

In 1981, the term 4GL was actually used to refer to languages which were <em>non-procedural. </em>A procedural language does not possess <em>object-oriented </em>capabilities. 4GL's often times have OOP properties, so I believe the answer to this question is going to be <em>false. </em>=)
7 0
4 years ago
. _______ view focuses on the text and content of a document, without much information on the page layout.
Georgia [21]
Read view
It allows to hide all instrument panels
5 0
3 years ago
Carlos had 194 seeds and 11 flower pots he put the same number of seeds in each flower pot which is the best estimate for the nu
Anon25 [30]

Answer: in solution.

Explanation:

It is basically 194 divided by 11 since we are evenly grouping 194 seeds into 11 pots. This gives 17.636363…

This means that the best estimate is around that number.

6 0
3 years ago
To remove any hidden data from your document before sharing it, what should you do?
almond37 [142]
B. becasue the repeation of a b and c i assume its not d, for that could be too easy it says REMOVE so that being the key word i ruled out A and C
4 0
3 years ago
Other questions:
  • What should a career plan include?
    7·1 answer
  • What action makes RAM on your computer disappear?
    12·2 answers
  • Truncation is a keyword search technique that helps you find useful variations of a term or terms. You want to find books on the
    5·1 answer
  • All of the following activities may infect your computer with a virus EXCEPT ________.
    6·1 answer
  • In round-robin scheduling,a) the time quantum should be larger than the context switch time. b) the time quantum should be as sm
    15·1 answer
  • Microcomputers, different from those giant mainframes and supercomputers, are designed for individuals. In fact, the microcomput
    7·1 answer
  • A network administrator is configuring the triggering mechanism for the network-based IPS by defining a pattern of web surfing a
    10·2 answers
  • Allie is working on the development of a web browser and wants to make sure that the browser correctly implements the Hypertext
    7·1 answer
  • When browsing using certain browsers, if a page is known to be malicious or using phishing techniques in the past a browser may
    5·1 answer
  • ____________________________ and _________________________ are 2 positive impacts of the internet on businesses.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!