My First Python Program: A Simple Calculator
Today, I am going to create a simple calculator using Python . This might be your first code ever , and honestly, this is also my first Python code . So don’t worry — we are learning together. Let’s start step by step. Step 1: Open VS Code First, open Visual Studio Code (VS Code) . Step 2: Create a Folder and a File Create a new folder (you can name it anything). Inside the folder, create a new file. In my case, I named the file first.py . 👉 .py is the file extension for Python , just like: .cpp for C++ .java for Java Step 3: Write the Python Code Now, write the following code in first.py : num1 = float ( input ( "Enter num 1: " ) ) # Taking first number from the user num2 = float ( input ( "Enter num 2: " ) ) # Taking second number from the user opr = input ( "Enter operator: " ) # User selects the operator (+, -, *) if opr = = "+" : # If operator is + output = num1 + num2 if opr = = "-" : # If operator is - ...