Question

Create a progam that stores a function that subtracts two numbers and displays the result in...

Create a progam that stores a function that subtracts two numbers and displays the result in the shell, and call it in the main file. Use python please

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def subtract(x,y):
    return x-y

# Testing
x = int(input("Enter first integer: "))
y = int(input("Enter second integer: "))
print(subtract(x,y))

Add a comment
Know the answer?
Add Answer to:
Create a progam that stores a function that subtracts two numbers and displays the result in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python 3 please and thank you Task 3: Create a Function 7 Create the function TotalRewardPoints...

    Python 3 please and thank you Task 3: Create a Function 7 Create the function TotalRewardPoints which accepts the dictionary that you created in Task 1 and a list of ticket purchases and displays the information as shown below. Ticket Purchase List is formatted as [Number of Tickets, Type of Ticket....] The total reward points a user gets is calculated by using the following formula: Reward Points = Number of Ticket Bought x Reward Points for that Ticket Type Your...

  • need help with this python progam using numpy Create a 4x4 two dimensional array with numbers...

    need help with this python progam using numpy Create a 4x4 two dimensional array with numbers from 1 thru 16. show this then: Change the last element by dividing it in half. Show that the original array has changed. show this then: Set all values in row 2 to zero. Show the original array contains this change show this then: Set all values in column 1 to one. Shoe the original array contains this change. show this then: Display the...

  • write a c++ program: User enter in 5 numbers, stores  them in an array then displays them...

    write a c++ program: User enter in 5 numbers, stores  them in an array then displays them from least -> greatest. Then create a char array the user will enter some letters, it gives a count on every 'a' then it gets replaced by an uppercase 'A'. Display the result. Then display only the last letter.

  • Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers,...

    Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers, multiplies them together, and prints out the sentence '____ times ____ is ____'. Ask the user for two numbers, and call multiply_and_print with their two numbers as arguments. 2.Write a function called roll_dice that rolls two six-sided dice and prints out the result of each die. Call it three times. (Remember, you can import the random module with the statement import random, and then...

  • how to do the fun1.m function? 1.1 Part 1 First, learn how to create a function...

    how to do the fun1.m function? 1.1 Part 1 First, learn how to create a function in MATLAB. Given the function U(T) = 0.12 – 2 sin(1) Create a MATLAB function that you can call from the main *.m file. Use the MATLAB Help by typing help function to learn about it. There are more than one way to create a function in MATLAB. For this lab, use the most basic one, i.e., by creating a function file that contains...

  • 2. This function compares two numbers and returns them in increasing order. 1. Fill in the...

    2. This function compares two numbers and returns them in increasing order. 1. Fill in the blanks, so the print statement displays the result of the function call in order. 1 # This function compares two numbers and returns them 2 # in increasing order. 3 - def order_numbers(number1, number2): 4. if number2 > number1: return numberi, number2 6 else: return number2, number1 9 Run # 1) Fill in the blanks so the print statement displays the result # of...

  • Create an external JavaScript file/code and then write a function that displays an alert box. This...

    Create an external JavaScript file/code and then write a function that displays an alert box. This box will display when the user clicks the submit button to submit the information typed in the form, so be sure the alert box contains an appropriate message. please use the OnClick event handler for your form's submit button.

  • This program should use a main function and two other functions named playlist and savelist as...

    This program should use a main function and two other functions named playlist and savelist as follows: The main function: The main function should create an empty list named nums and then use a loop to add ten integers to nums, each integer in the range from 10-90. NOTE: In Python, a list is a data type. See Chapter 7. The main function should then call the playlist function and savelist function, in that order. Both of these functions take...

  • Write a program that will do the following. The main function should ask the user how...

    Write a program that will do the following. The main function should ask the user how many numbers it will read in. It will then create an array of that size. Next, it will call a function that will read in the numbers and fill the array (fillArray). Pass the array that was made in themain function as a parameter to this function. Use a loop that will read numbers from the keyboard and store them in the array. This...

  • Write a program that will add two numbers stored in memory (you can write any values...

    Write a program that will add two numbers stored in memory (you can write any values in any section of memory you like). Subtracts 2 from that number, then displays the result to the screen before moving the result to memory for long term storage. Include memory map, instructions and a data example to show that it works. Create this by using the following list of instruction

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT