![leighsa](/avatars/44419.jpg)
leighsa
15.10.2020 •
Computers and Technology
Here we have a program which is calling the subtract function to calculate the difference between two numbers. The value from the 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
Solved
Show answers
More tips
- C Computers and Internet How to Delete a Page on VKontakte: The Ultimate Guide from Experts...
- S Style and Beauty 5 Tips for Choosing the Best Ugg Boots...
- H Health and Medicine How to Treat the Flu: A Comprehensive Guide...
- H Health and Medicine Effective Ways to Treat Colic in Infants...
- C Computers and Internet IMHO: What is it, why is it important, and how to use it?...
- F Food and Cooking How to Calculate the Gender of Your Child with Blood?...
- S Style and Beauty How to Get Rid of Under Eye Bruises?...
- C Cities and Countries What time does the Metro open in Moscow?...
- W Work and Career Where can you learn to be a flight attendant?...
- H Health and Medicine What are Electronic Cigarettes? The Ultimate Guide...
Answers on questions: Computers and Technology
- C Computers and Technology Abdullah wants to send sessitive data. Abdullah wants to make sure that only ahmed can see and read this. How can abdullah protect this data, so that ahmed can only...
- C Computers and Technology How do you open two different picture in photoshop?...
- C Computers and Technology If you are working on an isolated test network (that is, a testbed), what piece of equipment can you use to simulate a heavy network load?...
- C Computers and Technology Create a website for an online movie rental store, using HTML (and any other client technologies) and PHP. The website should include: - A front/home page containing...
- B Biology Which of the following examples of factors of production will cause a decrease in the production of wheat? poor soil nutrition an increase in irrigation a more efficient...
- M Mathematics Only answer if you know how to do it. a sofa is on sale for $555, which is 26% less than the regular price.what is the regular price? : )...
- B Biology Name the 5 scientists who contributed to what we now know about cells and explain their contributions....
- H History What unprecedented actions resulted from the opec embargo and how did it change american energy policy...
- H History What region of mexico contains large deposits of oil and natural gas...
- E English How is personification used in turnball...
Ответ:
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
4 minus 10 equals -6
Which is different from the expected output of
10 minus 4 equals 6
Modify
solution = minuend-subtrahend
to
solution = subtrahend - minuend
And that does it.
Ответ:
What am I suppose to do here? (I'll edit this answer when I know what I'm supposed to enter)
Explanation: