Question: I need help with this python code.I did it but i am gettting this error. This is my code i = 1 def add(a, b):

 I need help with this python code.I did it but i

am gettting this error. This is my code i = 1 defadd(a, b): return a + b def subtract(a, b): return a -b def multiply(a, b): c = 0 for i in range(0,a): c

= add(b, c) return c def divide(a, b): q = 0 r

I need help with this python code.I did it but i am gettting this error.

= 0 while a >= b: q += 1 a = subtract(a,

This is my code

i = 1

def add(a, b):

return a + b

def subtract(a, b):

return a - b

def multiply(a, b):

c = 0

for i in range(0,a):

c = add(b, c)

return c

def divide(a, b):

q = 0

r = 0

while a >= b:

q += 1

a = subtract(a, b)

r = a

return q,r

def factorial(a):

fact = 1

for i in range(2,a+1):

fact = multiply(fact, i)

return fact

def double_factorial(a):

fact = 1

final_fact = 1

for i in range(2, a+1):

fact = multiply(fact, i )

for i in range(2, fact+1):

final_fact = multiply(final_fact, i)

return final_fact

def main():

while True:

print("***welcome to the calculator Application*** ")

print("please choose an operation: ")

print("(A) - Addition ")

print("(S) - Subtraction ")

print("(M) - Multiplication ")

print("(D) - Division ")

print("(F) - Factorial ")

print("(DF) - Double Factorial ")

print("(Equation(Sequence of Opeations) ")

print("(Q) - Quit ")

choice = input("Choice:")

if choice not in["A", "S", "M", "D", "F", "DF", "E","Q"]:

print(" Invalid choice, Please select any of the given option!!")

elif choice == "Q":

print("Goodbye!!")

break

elif choice == "A":

a = input(" Enter the first integer:")

b = input(" Enter the second integer:")

c = add(a, b)

print(" {} + {} = {} ".format(a, b, c ))

elif choice == "S":

a = input(" Enter the first integer:")

b = input(" Enter the second integer:")

c = subtract(a, b)

print(" {} - {} = {} ".format(a, b, c ))

elif choice == "M":

a = input(" Enter the first integer:")

b = input(" Enter the second integer:")

c = multiply(a, b)

print(" {} * {} = {} ".format(a, b, c ))

elif choice == "D":

a = input(" Enter the first integer:")

b = input(" Enter the second integer:")

c = divide(a, b)

print(" {} / {} : quotient = {}, remainder + {} ".format(a, b, c[0], c[1] ))

elif choice == "F":

a = input(" Enter the integer:")

c = factorial (a)

print(" {}! = {} ".format(a, c ))

elif choice == "DF":

a = input(" Enter the integer:")

c = double_factorial (a)

print(" {}!! = {} ".format(a, c ))

elif choice == "E":

i = 0

result = True

eq = ""

while True:

if i == 0:

a = int(input("Enter integers: "))

eq += str(a)

i = 1

o = input("enter Operator: ")

eq += str(o)

b = int(input("enter integer : "))

eq += str(b)

if o == "+":

if result == True:

result = add(a, b)

else:

result = add(result, b)

if o == "-":

if result == True:

result = subtract(a, b)

else:

result = subtract(result, b)

if o == "*":

if result == True:

result = multiply(a, b)

else:

result = multiply(result, b)

if o == "/":

if result == True:

result = divide(a, b)

else:

result = divide(result, b)

q = input("Enter q to quit")

if q == "q":

print("Equation {} result is :{} ". format(eq,result))

main()

Can i kindly get help with this with the code

Basic Integer Calculator In this assignment you will reate an interactive basic integer calculator program Menu Upon starting the program, the user will be presented with a welcome message followed by a menu of all of the available operations the calculator can perform. Here is a sample of what your welcome message and menu could look like -Welcome to the Calculator Application Please choose an operation: (AAddition (S)-Subtraction (M) -Multiplication D)Division (E)- Factorial (DF) Double Factorial (E) Equation (sequence of operations) (Q)-Quit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!