Python is one of the most efficient, and easy to learn programming language with the simplest syntax. Python has the following two versions:
- Python 2
- Python 3
There is a major difference between python 2 and python 3. For instance, one difference is the print statement. In python 2, the print statement is not a function. It is considered as a simple statement. Whenever we use the print statement in python 2, we do not use the parenthesis. On the other hand in python 3, print is a function and it is followed by the parenthesis.
In any programming language, the simplest “Hello World” program is used to demonstrate the syntax of the programming language. In this article, we create the “Hello World” program in python 3. Spyder3 editor is used to creating and running the python script.
Creating a Hello World Program
For creating the Hello World program, you will need to perform the following steps
- Open the Spyder3 editor.
- Go to the “File” menu and click on “New File”. A new python file will be created.
- Now simply write the program print(“Hello World”)
- Click on the “Run” button.
- After clicking on the “Run” button, a window will be prompted. Type the name of the file that you want to assign to this file. We give the “Hello World” name to file. After that, choose the directory where you want to save this file and click on the “Save” button.
- If you are running a spyder3 editor for the first time, then you have to run the setting for your newly created python script. In the console, the menu chooses “Execute in current console” and in the working directory settings menu choose the first option “The directory of the file being executed” and click on the “Run” button.
- Finally, you can see the output “Hello World” on the console.
Conclusion
In this article, we have described how you can create your first program “Hello World” in python. By following the steps described in this article you can easily create the “Hello World” program.
from Linux Hint https://ift.tt/2H4RA9K
0 Comments