First Program

Now that you have python installed its time to create your very first program. Before moving to your first program you need to install text-editor for python.

For windows

Notepad++
PyCharm
Eclipse
Sublime Text

For Linux

PyCharm
Gedit

For Mac

Atom
PyCharm

These editors are good and freeware. I will be using PyCharm or Atom throughout my series. My system is mac so I have to use python3.x as a command, but in windows, you can use simple python as a command.

First program

Now let's write first hello program

print("Hello World")
print("This is my first program")

 Save this file as first.py. .py is extension used for python file. To run this program open terminal/cmd and goto location of file and then run it as

python first.py

What you should see?

Program:

First Program

Output:

First Python Program Pyghost

Comment in Python

To put a comment in python code you can use # before code.

output:

First Python Program Pyghost

 

Tips:

  1. Always use comment '#' while programming, its very helpfull to understand your code when you read it back.
  2. Devide your programs in section to make it more easy.

About the author

akarperiwal

0 Comments

Please login to comment