#Scientific Calculator
import math
print ("MAIN MENU")
print ("1. Addition")
print ("2. Subtraction")
print ("3. Multiplication")
print ("4. Division")
print ("5. Modulus")
print ("6. Exponentiation")
print ("7. Absolute value")
print ("8. Factorial")
print ("9. Logarithm")
print ("10. Round Up")
print ("11. Round Down")
print ("12. Square Root")
print ("13. Trigonometric Functions")
print ("14. Inverse Trigonometric Functions")
print ("15. Hyperbolic Functions")
print ("16. Inverse Hyperbolic Functions")
print("")
print ("NOTE: If you're performing operations in the 1-6 range, don't make the second number zero." )
print()
op = int(input("Enter the operation you want to perform : "))
Question:
1. In this program you will create a class and OOP
import math
print("MAIN MENU")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Modulus")
print("6. Exponentiation")
print("7. Absolute value")
print("8. Factorial")
print("9. Logarithm")
print("10. Round Up")
print("11. Round Down")
print("12. Square Root")
print("13. Trigonometric Functions")
print("14. Inverse Trigonometric Functions")
print("15. Hyperbolic Functions")
print("16. Inverse Hyperbolic Functions")
print("")
print("NOTE: If you're performing operations in the 1-6 range, don't make the second number zero." )
print()
op = int(input("Enter the operation you want to perform : "))
if op == 0:
print("Thank you for using our calculator!")
if op == 1:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first + second
print("1. Addition")
print(result)
if op == 2:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first - second
print("2. Subtraction")
print(result)
if op == 3:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first / second
print("3. Multiplication")
print(result)
if op == 4:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first * second
print("4. Division")
print(result)
if op == 5:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first % second
print("5. Modulus")
print(result)
if op == 6:
first = int(input("Give the base: "))
second = int(input("Give the power value: "))
result = first ^ second
print("6. Exponentiation")
print(result)
else:
print("Please enter the value from 0 - 6")
Comments
Leave a comment