(Solved) : Final Project Write Calculator Program Python Following Characteristics Must Least 50 Line Q37211193 . . .
For the final project, you are to write a calculator program inPython with the following characteristics:
- It must be at least 50 lines of code excluding comments
- It must have the following functions:+,-,*,/, SQRT, and workwith decimal numbers.
- It must be all text, no high resolution graphics
- It must automatically copy the result to the operating systemclipboard
- It must work as a functional calculator (calculations can beentered over and over)
I have the following code and it works just fine, but I amhaving trouble figuring out how to do number 4. I do not know howto make the result automatically copy itself to the operatingsystem clipboard…can someone please explain?
# Python program for calculatorimport math# Function to add two numbersdef add(num1, num2): return num1 + num2# Function to subtract two numbersdef subtract(num1, num2): return num1 – num2 # Function to multiply two numbersdef multiply(num1, num2): return num1 * num2# Function to divide two numbersdef divide(num1, num2): return num1 / num2print(”’Please select operation -n1. Addn2. Subtractn3. Multiplyn4. Dividen5. Square Rootn6. Exit”’)# Take input from the userselect = input(“Select operations form 1, 2, 3, 4, 5, 6 : “)print()while select : if select == ‘1’: # Take input from the user number_1 = float(input(“Enter first number: “)) number_2 = float(input(“Enter second number: “)) result = add(number_1, number_2) print(“Result is :”, result) print() elif select == ‘2’: # Take input from the user number_1 = float(input(“Enter first number: “)) number_2 = float(input(“Enter second number: “)) result = subtract(number_1, number_2) print(“Result is :”, result) print() elif select == ‘3’: # Take input from the user number_1 = float(input(“Enter first number: “)) number_2 = float(input(“Enter second number: “)) result = multiply(number_1, number_2) print(“Result is :”, result) print() elif select == ‘4’: # Take input from the user number_1 = float(input(“Enter first number: “)) number_2 = float(input(“Enter second number: “)) result = divide(number_1, number_2) print(“Result is :”, result) print() elif select == ‘5’: # Take input from the user number_1 = float(input(“Enter first number: “)) result = math.sqrt(number_1) print(“Result is :”, result) print() elif select == ‘6’: exit(0) else: print(“Invalid input”) print() print(”’nPlease select operation -n1. Addn2. Subtractn3. Multiplyn4. Dividen5. Square Rootn6. Exit”’) # Take input from the user select = input(“Select operations form 1, 2, 3, 4, 5, 6 : “)
Expert Answer
Answer to For the final project, you are to write a calculator program in Python with the following characteristics: It must be at…
OR