Post 1: An introduction to Python.
Python is one of the most versatile and widely used programming language due
to the simplicity and readability. Python powers apps like Instagram and Pinterest and is commonly used in data analysis and machine learning. Its extensive libraries and frameworks help developers to solve problems creatively and efficiently.
What you’ll learn in this course:
- Basic concepts of coding in Python
- Completing your first Python project: a text-based game
- Building blocks for real-world Python applications
This course is designed for those who have never coded before (in Python or at all). No prior knowledge is required, though I highly recommend reading this list of general programming concepts before starting the course – Beginner Programming Concepts – techvetted
Lesson 1: Setting Up and Printing to Console
Step 1 – Installing the IDE and creating the file:
For this tutorial we will use Visual Studio Code (VS Code), a user-friendly, versatile IDE.
- Install visual studio code: Download Visual Studio Code – Mac, Linux, Windows and pick your platform.
- Follow the setup wizard to complete the installation.
- Create a folder on your device to save your programs.
- Open the folder in Visual Studio Code:
- Create a file in the folder.
- Name the file and add .py at the end, as this creates it as a python file.
Step 2 – Selecting the interpreter:
- Click the Select Interpreter button on the bottom right.
- If not already installed, install the latest python interpreter on your device
- Select the interpreter
Step 3 – Learning how to output to console:
- Create a print statement
- Insert quotation marks in the brackets to output a string (data types will be covered in the next lesson), and type your message between the quotation marks.
- Run the code pressing Run in the top right corner.
- The console will appear on screen with your message included
Experiment:
- Try creating multiple print statements to see if each statement outputs to a new line on the console
- Observe what happens if the message is too long for one line on the console
Next Lesson:
In the next section, we will learn how to:
- Store data
- Understand different data types
- Get data from a user and store it
- Output data in a presentable format
These are crucial skills for creating a text-based game and building any real-world application.