Do My Homework / Homework Help Answers / Python Homework Help / Adding exceptions to python code

Adding exceptions to python code

Need help with this question or any other Python assignment help task?

I have Written a simple python program that is a calculator. You can Set a low range, and a high range. You can also continue to use the calculator using loops. The calculator gives basic answers, (sum, difference, product,) I don’t know how to add exceptions to this code. I need to add 2 exceptions
Additional Instructions:
""" Program Name: Wk3_Isaiah_Padilla.py Stuent Name: Isaiah Padilla Course: ENTD 220 Instructor: Prof. Sammy Abaza Date: 20220626 Description: This code Is a basic calculator with a built in loop to repeat The process Given. Copy Wrong: This is my work. """ # addition function def add(x, y): return x + y # subtraction function def subtract(x, y): return x - y # multiplication function def multiply(x, y): return x * y # division function def divide(x, y): return x / y # declaring initial loop value to begin loop loopinput = 'Y' # start of loop while loopinput == 'Y': # user input limitlow = int(input("Enter your Lower range ---> ")) limithigh = int(input("Enter your Higher range ---> ")) num1 = int(input("Enter first number ---> ")) num2 = int(input("Enter second number ---> ")) print("") # check input range and kill program in needed if num1 < limitlow: print("The input values are out side the input ranges") print("Please check the numbers and try again") print("Thanks for using our calculator") quit() elif num2 > limithigh: print("The input values are out side the input ranges") print("Please check the numbers and try again") print("Thanks for using our calculator") quit() else: # printing results print("The Result of ",num1,"+",num2,"=", add(num1,num2)) print("The Result of ",num1,"-",num2,"=", subtract(num1,num2)) print("The Result of ",num1,"*",num2,"=", multiply(num1,num2)) # preventing divide by 0 if num2 == 0: print("The Result of ",num1, "/",num2,"=If one divides by zero, one may not use this calculator") else: print("The Result of ",num1,"/",num2,"=", divide(num1,num2)) print ("") # final output print("Thank you Thank you come again!!") # checking with user if loop should continue loopinput = input("Continue Looping? Y/N ") # assigning true false values to user input if loopinput == 'Y': validinput = True elif loopinput == 'N': validinput = True else: validinput = False # checking for valid input, and looping input if input is invalid while validinput != True: print("This is not a valid input, please try again.") loopinput = input("Continue Looping? Y/N ") if loopinput == 'Y': validinput = True elif loopinput != 'N': validinput == True else: validinput = False
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other others

Get Help With a similar task to - Adding exceptions to python code

Related Questions

Similar orders to Adding exceptions to python code
187
Views
2
Answers
284
Views
2
Answers
Popular Services
Tutlance Experts offer help in a wide range of topics. Here are some of our top services: