Question 1: Determining whether an equation is valid or not

Given three integers X, Y, Z, determine whether it is possible to add, subtract, multiply or divide X and Y to produce Z. Only one operation may be used to produce Z.

Write a Python program which accepts inputs X, Y, Z from the user and compute whether it is possible to add, subtract, multiply or divide X and Y to produce Z. Y will not be zero.

U2-L1-02.png

Function Input Argument(s):

There will be 3 inputs

  1. X (integer)
  2. Y (integer)
  3. Z (integer)

Function Return Value:

The program should print a single line of output. If it is possible to add, subtract, multiply or divide X and Y to produce Z, print out the string 'yay'. If not, print out the string 'nay’

Example 1

Function Input Argument(s):

(3, 2, 6)

Function Return Value:

"yay”

Example 2:

Function Input Argument(s):

(3, 5, 6)