For all of the following, write both the function and some code that calls and tests the function.
Complete the following without using ANY outside aid. If necessary, refer only to the python help()
command or the official documentation at https://python.org.
Use PyCharm to complete this task. I know that PyCharm has a built-in AI Assistant. I strongly recommend that you disable it. You are going to be quizzed on these skills in class, and you will not be allowed to use any outside assistance.
multiply()
with two parameters, a
and b
, that returns the result.a
and b
are integers.a
or b
is not an integer.divide()
with two parameters, a
and b
, that returns the result of a
/ b
.a
and b
are either integers.a
or b
is not a number.b
equals 0
.calculator
functionmultiply
, divide
, or exit
.exit
, the program must end.a
and b
.multiply()
or divide()
function.multiply()
or divide()
returns nothing, print an error message.4 * 5 = 20
or 2.4 / 1.2 = 2.0
.divide
result to the tenths place using the built-in round()
function when printing.Submit your .py
file to Canvas for a check. You are not graded on completeness or correctness – this is for learning and feedback.
if
.isinstance()
.