Drop links or images here to add them to the editor.

In a make task you use the skills you have learned to create a program from scratch. There is no starter code: you begin with an empty editor.

You are going to write a calculator. It takes two numbers and a choice of operation from the user, works the answer out in a sub program, and prints it.

Your task

Define four sub programs, named add, subtract, multiply and divide.

Then write the main program, underneath the four definitions.

The output

The three questions are printed exactly as written above, followed by exactly one more line, whatever the user types.

When one of the four sub programs was called, that line is worded exactly like this:

The answer is 19

The words The answer is, then a space, then whatever the sub program handed back. When the choice was not 1, 2, 3 or 4, the line is exactly this instead:

Sorry, that is not one of the four options

Watch out for the division

The / operator always produces a decimal number, even when the division comes out exactly. 10 / 4 gives 2.5, and 8 / 2 gives 4.0 rather than 4.

That is what your program should print. Do not round the answer, and do not cast it back to a whole number with int(): the tests expect what / actually gives you. The other three operations work on whole numbers and print without a decimal point.

Example

Input:

12
7
1

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
The answer is 19

Input:

40
55
2

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
The answer is -15

(40 minus 55, so the answer is negative)


Input:

6
9
3

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
The answer is 54

Input:

10
4
4

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
The answer is 2.5

(10 divided by 4)


Input:

8
2
4

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
The answer is 4.0

(the division comes out exactly, and / still gives a decimal number)


Input:

5
3
7

Output:

Enter the first number:
Enter the second number:
Enter 1 to add, 2 to subtract, 3 to multiply or 4 to divide:
Sorry, that is not one of the four options

(7 is not one of the four choices, so nothing is calculated)

All three questions are part of the output that is checked here, so their spelling, capital letters and punctuation count. Ask each one with its own print, exactly as written above, and read the answer with a bare input() on the next line, rather than passing the question to input(...).

Help! My code doesn't work!

Make sure that you check for the following things:

  • The sub program names are spelled identically on the def lines and at the calls. Capital letters count.
  • There is a colon at the end of every def, if, elif and else line.
  • The body of each sub program is indented, and every line of it by the same amount. Never mix tabs and spaces in one file.
  • The calls are not indented inside a sub program. They belong to the branches of the if chain in the main program.
  • All four sub programs are defined before the main program calls them.
  • Each def line has two parameters, and each call passes two arguments.
  • Each sub program uses return, not print. A sub program that prints its result hands nothing back, so there is nothing for the main program to store.
  • Every input is wrapped in int(), including the one that collects the choice, or the choice is compared as text and never matches.
  • The number is converted with str() before it is joined onto the sentence with +.
  • The message is spelled and capitalised exactly as it is written above.