8  python hello world

Printing a “Hello World” sentence to screen is the traditional first program in many languages. For python this is very easy one line code.

  1. Open a new file in a Programmers Text Editor and write following line
    print("hello world!")
  1. save the file as helloworld.py and exit editor.

  2. Open a command line/Terminal

  3. Go to folder you have saved your file

  4. Write

    python helloworld.py

example code

8.1 Python interpreter

Python is different from some languages such as C and java that it is not a compiled language but an interpreted language.

python code --> python interpreter --> output

8.2 comments

If we want to some of the writing to be not interpreted (executed) by python, we should use comments. Comments are ignored by python interpreter. See below example for comments.

# this will not run
print("hello world!")
# this will also not run

# There is not multi line comments 
# but you can use multi line strings as such

'''
This is a multiline
comment.
'''


"""
This is an another multiline
comment.
"""

download above example comments code

8.4 Video Tutorials