Your First Python Program
Congratulations on setting up your Python environment! Now, it's time to write your first Python program. In this lesson, we'll guide you through creating a simple "Hello, World!" program.
Writing Your First Program
Open your preferred code editor or IDE and create a new file. Save the file with a `.py` extension, for example, `hello_world.py`.
print("Hello, World!")Understanding the Code
Let's break down the code:
- `print()`: This is a built-in Python function that outputs text to the console.
- `"Hello, World!"`: This is the string of text we want to print.
Running Your Program
To run your program, open a terminal or command prompt, navigate to the directory where you saved your file, and type `python hello_world.py`.
You should see the output `Hello, World!` in your terminal or command prompt. Congratulations, you've just run your first Python program!
The "Hello, World!" program is a traditional first program in many programming languages. It's a simple way to verify that your environment is set up correctly and to get started with coding.