Posts

Creating a Calculator in python with calculation history

Image
calculator with calculation history in python  past_calculations =[]; def add(a,b):   return a+b;    def subtract(a,b):   return a-b;    def multiply (a,b):   return a*b; def divide(a,b):   try:     return a/b   except Exception as e:     print(e) def power(a,b):   return a**b    def remainder(a,b):   return a%b    def history():   if past_calculations:     for index,calc in enumerate(past_calculations):         print(calc);   else:     print("No past calculations to show");     return 0;      def select_op(choice):   if (choice == '?'):     return history()    if (choice == '#'):     return -1   elif (choice == '$'):     return 0   elif (choice in ('+','-','*','/','^','%')):     while (True):       num1s = str(input("Enter first number...

Inverted triangle pattern in C++

Image
    This is the source code for printing inverted triangle pattern in C++: Output:

What is Object Oriented Programming?

Image
  What is Object Oriented Programming?   OOP is a programming paradigm that represents concepts as "objects" that have data fields (attributes that describe the object) and associated procedures known as methods. Object Oriented Programming is a programming that relies on the concept of classes and objects. Advantages of OOP  Provides a clear modular structure for programs OOP makes it easy to maintain and modify existing code (new objects can be created with small differences to existing ones) OOP provides a good framework for code libraries Software components can be easily adapted and modified by the programmer  Many of the most widely used programming languages (such as C++, Java, Python, etc.) are  multi-paradigm  and they support object-oriented programming to a greater or lesser degree, typically in combination with  imperative ,  procedural programming In this article we will talk about OOP with Java language. Concepts of OOP What is an Ob...