First Python Program
In this Section, we will discuss the basic syntax of Python, we will run a simple program that prints the message "Hello World" to the console
Example
print("Hello, World!")
To run this program, follow these steps:
- Open a text editor (such as Notepad, Sublime Text, or Visual Studio Code) and create a new file.
- Copy the above code and paste it into the new file.
- Save the file with a .py extension, for example, hello.py.
- Open a command prompt (on Windows) or a terminal (on macOS/Linux).
- Navigate to the directory where you saved the hello.py file using the cd command (e.g., cd Documents/Python).
- Type python hello.py and press Enter to run the program.
You should see the output Hello, World! displayed in the console.
This program is a basic example to get you started. You can build upon this foundation and explore the vast possibilities that Python offers for programming tasks, such as data analysis, web development, machine learning, and much more.