Welcome back to another class of Python Programming, where we learn python from scratch, it doesn’t matter if you are new to programming or even computers, I will have your back in every step you take to get to know more about programming languages or computers.
So, in the previous class, we get to know what is a programming language and how you can start your journey as a beginner. In Today’s class, we will create our first Python Program. But first, we need to set up some things in order to proceed further.
First, we have to download and install an IDE in our workstation.
What is an IDE?
An IDE or Integrated Development Environment is a software application which helps us in writing code for software development.
Now you will ask, why we need an IDE? Is it mandatory to use one?
The answer is NO. You can also write your program in a text editor like notepad but it doesn’t have all the features that an IDE has. Like a built-in compiler, debugger, better code editor with a number of important features, a syntax highlighter, and many more. In short, it is far better to use an IDE for your developments as compared to a normal text editor.
Moving on, there are a number of IDEs’ in the market like PyCharm, CodeBlocks, VS Code, Jupytor Notebook, etc.
But we will be using Visual Studio Code. Now WHY VS CODE?
Because It is developed and Microsoft and it is absolutely free. It is available in Windows, Linux, and Mac OS for download. It is great for doing your development as it is very handy when you are working with different projects with different languages. And I personally liked it a lot. You can also go with other choices out there like PyCharm or Jupyter Notebook.
Getting the IDE ready for use
First Download the VS code from here: https://code.visualstudio.com/
Download the Python latest version from here: https://www.python.org/downloads/
You can check your Python Version in Windows by using cmd and typing Python.
Now you are good to go. Open up your Visual Studio Code. You will have a screen like this. Mine can be a little different as it is not a fresh install. Nothing is changed. Now follow up.
Go to File -> Open Folder. At first install, there wouldn’t be any folder. Don’t worry we will create one. Right Click on the Space and select New Folder. Rename it Python. Now select the folder.
Go to the side panel and click on the small icon here. Rename the file to Hello.py. “.py” is used to distinguish the python file. Python file uses this extension.
Now we are at the text editor. Let’s write our first program.
Writing our First Program.
In this program, we will print a text on the screen. In Python, we can easily do this using Print(“ text “). Let’s see how.
As you have noticed when you are typing “pr” the IDE uses its IntelliSense feature to give you the suggestion for code completion which comes handy when writing programs.
Now Let me tell you another interesting feature of VS code, it has a number of extensions you can use. The most popular one is Code Runner, Which can help you compile your code with just one click.
To install it. Go to extensions the last option in the side panel and write code runner then select and install it. Then a small triangular icon will appear on the top right-hand corner.
Now click the button and you can see the statement there on the output screen.
The print function prints the output within the inverted commas on the screen. Here you can see in the output screen or on the terminal screen.
Great! We just write our first program in Python. I know the IDE can be a little confusing sometimes but it required a dedicated class on it, explaining its features but for now, you can go with its default settings.
That’s all for today. If you haven’t checked out the previous class, Don’t worry! You can do it anytime here. Just visit here and don’t skip any part of your journey. This is Dolores Haze, signing off, I will be there for you in the next class, till then “Happy Coding”.