The very first program which any person would attempt when learning a programming language is to print “Hello World!”, today in this article you would learn how to print “Hello World!” in a simple Python Program.
# Writing the first program in Python
print "Hello World!";
Create a file and save above content with a file name “HelloWorld.py” and execute it by following the steps to run “.py” files as described below to see the output.
Steps to Run “.py” files.
- Make sure Python is installed in your Machine, In case Python is not yet installed, follow the simple steps to Download and Install Python in Windows machine / laptop.
- Open Command Prompt / PowerShell in Windows
- Use Commands to navigate to folder where the “HelloWorld.py” is stored.
- Type command “Python HelloWorld.py” without double quotes and press Enter key, you would see the output of the program
Output: on the console / command prompt
Hope this had given you a head start as how to work with Python Files.