Monday, July 26, 2021

Python Program to Make a Simple Calculator

 # Program make a simple calculator


# This function adds two numbers

def add(x, y):

    return x + y


# This function subtracts two numbers

def subtract(x, y):

    return x - y


# This function multiplies two numbers

def multiply(x, y):

    return x * y


# This function divides two numbers

def divide(x, y):

    return x / y



print("Select operation.")

print("1.Add")

print("2.Subtract")

print("3.Multiply")

print("4.Divide")


while True:

    # Take input from the user

    choice = input("Enter choice(1/2/3/4): ")


    # Check if choice is one of the four options

    if choice in ('1', '2', '3', '4'):

        num1 = float(input("Enter first number: "))

        num2 = float(input("Enter second number: "))


        if choice == '1':

            print(num1, "+", num2, "=", add(num1, num2))


        elif choice == '2':

            print(num1, "-", num2, "=", subtract(num1, num2))


        elif choice == '3':

            print(num1, "*", num2, "=", multiply(num1, num2))


        elif choice == '4':

            print(num1, "/", num2, "=", divide(num1, num2))

        break

    else:

        print("Invalid Input")


Kolkata! Culture and Heritage!

 Many people say that Kolkata was India’s Cultural Center and it is past. Let me tell you it is not true. We are still at the Cultural Center. May be our cultural practice is failing to bring enough success but believe me we are still on it. I used to believe the same too that we have lost the glory but a recent experience opened my eyes wide.


The day I visited Koshe Kosha (mentioned in my previous blog), I had to wait for my friends at Golpark. Since those idiots (we are 5 idiots) were terribly late, I decided to take a walk toward Gariahat. There is a public toilet below the Gariahut Flyover at the Golpark end and the stretch between the toilet and the Gariahat Crossing is well maintained. With seating arrangements that particular area is pretty clean and railed on the both side with wide bars. It’s a place always crowded and obviously more people are on the rails than on the seatings. Such hangout place cannot go on without a tea shop and it is there and that too is really good. Coincidentally I was really feeling to have something hot down my throat.

The moment I sat with the cup of coffee in hand, I was amazed by the view on the side rail bar!! People returning from office, are playing chess in groups, sitting on the rail bars. 4 to 5 groups were there with 3-4 members in each group. I have seen people playing cards here and there but chess!! Never!!

This is something possible for Bengalis only. Playing cards is no big deal. There are simple games of card and people with minimum intelligence can play those. You’ll hardly find people playing Bridge but Chess is really not a matter of joke. Those who are not intelligent enough may know the game but will not enjoy the game. Those people were enjoying the game like anything and it was kind of Rapid Chess. I do not have much idea about chess but I saw a group completing 3 games with a short span of 30 mins.

This is something really appreciable. Those guys are not going to play a grand master but definitely giving a strong message to the citizens how people can carry a good culture. They were spending time but in a creative way. We can be physically lazy but what it takes to spend some time doing something creative.

Got some snaps of the place and the people! Find it here. Also for your information you can join them too. Just visit them and ask to let you play a game. They will not reject you. So test your skill someday!!





 
  • an affair of flavours... © 2012 | Designed by Rumah Dijual, in collaboration with Web Hosting , Blogger Templates and WP Themes