Calculator Using Python Project

दोस्तों, इस पोस्ट (Calculator Using Python Project) में मैं आपको पाइथन की मदद से एक सिंपल कैलकुलेटर बनाने सिखाऊंगा. अगर आपको पाइथन में operators, loops और if – else के बारे नॉलेज है तो आप इस प्रोजेक्ट को काफी आसानी और जल्दी कर सकते है.


Calculator Using Python Project

Download Source Code:

सोर्स कोड डाउनलोड करने के लिए यँहा क्लिक करे. अगर डाउनलोड करने में कोई भी प्रॉब्लम होता है तो कमेंट करके हम से पूछे. Download Source Code


Example Code:

#simple calculator using python
choice=int(input(”’ Do you want to use calculator?
                             1. Yes
                             2. No”’))
while True:
 if choice==1:
  print(“****Calculator****”)
  user_input=int(input(”’ Here is what I can perform
                            1. Addition
                            2. Subtraction
                            3. Multiplication
                            4. Division
                            5. Percentage
                            6. Average of two numbers
                            7. Square of any number
                            8. Cube of any number”’))
      #addition
  if user_input==1:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      print(“Sum is”,num1+num2)
    calculator using python project
      #subtraction
  elif user_input==2:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      print(“Difference is”,num1-num2)
      #multiplication
  elif user_input==3:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      print(“Product is”,num1*num2)
    calculator using python project
      #division
  elif user_input==4:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      print(“Quotient is”,num2/num1)
      print(“Remainder is”,num2%num1)
      #percentage
  elif user_input==5:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      k=num1+num2
      print(“Percentage of first number”,(num1*100)/k)
      print(“Percentage of second number”,(num2*100)/k)
calculator using python
      #average
  elif user_input==6:
      num1=int(input(“Enter the first number”))
      num2=int(input(“Enter the second number”))
      sum=num1+num2
      print(“Average is”,sum/2)
      #square
  elif user_input==7:
      num1=int(input(“Enter the number whose square you want to find”))
      print(“Square is”,num1**2)
  elif user_input==8:
      #cube
      num1=int(input(“Enter the number whose cube you want to find”))
      print(“Cube is”,num1**3)
  else:
      print(“Invalid option selected”)
 elif choice==2:
     print(“You are out “)
     break;
 else:
     print(“Invalid choice”)

Read More Articles:


 

Leave a Comment