W5 APP

 W5 APP

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Please see attachments for prior assignment

Assignment Instructions

# This is the flower box and it should at the beginning of each assignment# You must add comments to your code # Program name   : Wk5_firstname_lastname.py # Student Name   : Ymmas Azaba # Course              : ENTD220 # Instructor         : My instructor # Date                 : Any Day# Description            : This code shall ….# Copy Wrong      : This is my workYou are going to enhance the prior assignment by doing the following 1) Move all the functions into  Mylib.py2) Use import to include Mylib into the code3) Test the code and make sure that the prior code is still working4) Add the following function into  Mylib    scalc(p1)    p1 will be a string like this “N1, N2, operator”    examples    scalc(“20,30,*”)    the result will be 600     scalc(“50,20,+”)    the result will be 70   scalc(“50,20,-“)    the result will be 30     scalc(“60,20,/”)    the result will be 30 use string functions to parse the first number, the second number, and the operator from the input string.use the prior functions (add, subtract, divide and multiply ) to do the calculations. Submission Instructions:Make sure that you save your code in a text file in this format;W5_firstname_lastname.py 

# Program name :
# Student Name :
# Course : ENTD220
# Instructor :
# Date : 01/24/2020
# Description : Simple Arithmetic
# Copy Wrong : This is my work
#add 2 numbers
def plus(n1,n2):
return n1 + n2
#subtract 2 numbers
def subtract(n1, n2):
return n1 – n2
#multiply 2 numbers
def multiply(n1, n2):
return n1 * n2
#division, n2 should not be zero
def divide(n1, n2):
try:
div = n1/(n2 + 0.0)
print(“The result of %d/%d=%f” % (n1, n2, div))
except ZeroDivisionError as e:
print(“The result of %s/%s = %s” % (n1, n2,”You cannot divide by Zero”))
except Exception :
print(“Invalid input”)
#test the divide function
def test_divide():
print(“————Tests——————“)
divide(5, 0) #catch division by zero
divide(“4”, “2”) #catch invalid number exception
print(“———————————–“)
def IsInRange(lr, hr, n):
return lr < n and n < hr def main(): low = int(input("Enter Lower range:")) high = int(input("Enter Higher range:")) n1 = int(input(“Enter first number:”))
n2 = int(input(“Enter second number:”))
#n1 and n2 must be in range
if IsInRange(low , high, n1) and IsInRange(low , high, n2):
add = plus(n1 , n2)
sub = subtract(n1 , n2)
mul = multiply(n1 , n2)
#use print formating, %d = double, %f = float, %s = string
print(“The result of %d+%d=%d” % (n1, n2, add))
print(“The result of %d-%d=%d” % (n1, n2, sub))
print(“The result of %d*%d=%d” % (n1, n2, mul))
divide(n1, n2)
else:
print(“Errors: input out of range”)

while True:
main()
yn = str(input(“Continue Looping Y/N:”))
if yn == “N”:
break
test_divide()
print(“Thanks for using our calculator!”)

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

I implemented the exception in divide function, its purpose is to
trap divide by zero exceptions and other exceptions such as TypeError.

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP