Search Here

Python Hello World

Hello friends how are you!!! today you will learn how to program in python. In this lesson we create a simple Hello World program using python.

Hello World Python:
     In this tutorial we are going to use the traditional "Hello, World!" program. And the purpose of "Hello, World!" is not an exercise to find the simplest form of code in a particular language, or anything like that. Its actually to learn about the development environment, and this is what we called development cycle (it takes to edit, and to test, and to change, and to test and to run code in a particular environment). And so for this purpose we use the simplest form of a program itself, so that can get out of the way and then we can focus on the environment.


In this case, I have this up here on the screen in Eclipse. And this is Eclipse using Pydev, which is a Python development environment that runs inside of Eclipse.

Python Tutorial | Syntax in Python | Hello World 

         Eclipse is an integrated development environment originally written for developing in Java, but it has plug- ins for a lot of different languages. And Pydev is actually a pretty good plug-in for the Python language. And so, we will be using this throughout this course.You do not have to use Eclipse, and if you have some other development environment that you prefer, or you just want to use an editor and a command line, that's perfectly fine. In the above screen shot I have created a python project named "Tutorial" and in that project I have created a ".py" file named "HelloWold.py". 

Now its time to write our first program. In the Eclipse editor write the below code to print your first program.
     print("Hello, Wrold!") 

Python Tutorial | Syntax in Python | Hello World 

 In Eclipse, if I want to run this Hello, World!, I simply click on this Run button up here, and it will ask me, How I want to run it? and I am going to select Python Run. I only need to do this the first time I run a script.So I am going to say OK.

Python Tutorial | Syntax in Python | Hello World 

 And here we have the result down here: "Hello, World!"


Python Tutorial | Syntax in Python | Hello World

 For writing python programs you can also use python IDLE (shell). To open python IDLE follow these steps:
  1. Press "window" button.
  2. write "idle" on search bar.
  3. Click on  "IDLE (python_version)"
Python Tutorial | Syntax in Python | Hello World 

     4. You will see the following screen and this is the python "IDLE"shell.

Python Tutorial | Syntax in Python | Hello World

     5. Now we in the python shell write "print("Hello, World!")" and press enter, you will see your desired output.

Python Tutorial | Syntax in Python | Hello World 

This is the end of our first lesson, today you learned about Python and Eclipse development environment and how to write program in python. In my next post you will learn python variable, loops, function etc.....

Post a Comment

1 Comments