Write a Hello World Program in Python

Python is a general purpose interpreted ,high-level and object oriented programming language. This language is easy to learn, easy to read, easy to maintain and much more portable. So often it is called a beginners language. It supports almost every operating system.

Steps

  1. Visit Python's official website at www.python.org.
  2. Download the most recent Python installer for your operating system.
    • Now you have the file called python xxx.mse is ready(xxx is the version name)
  3. Install it by following some basic steps
    • Now python is successfully installed in your system you can run Python now just going to command prompt
  4. Go into python installed directory in command prompt.
  5. Now, the syntax of the actual program varies depending on what version of the Python interpreter you downloaded.
  6. Write to the command line: print ("Hello, world!") and push Enter.
  7. Result: "Hello, world!"

Tips

  • It would be better if you chose a text editor to programming with python. There are a numbers of text editors. One good software is sublime text editor. In this text editor you can write python program and view the outputs too. Although, you can use the IDLE that comes with Python. It includes the text editor (with syntax highlighting that helps) for programming in Python.
  • The print function prints a message in Python. Note that you must save the python file with extension of .py e.g-hello_world.py
  • Go to tools->build system and select python
    • You have to set environment variable now. Go to my computer->properties->advanced->environment variables->new
    • In variable name type path. In variable value write the path of you python.exe file.(G:\python\pyth)
    • If you on Linux, change your current directory to a path that you want to build your program. Ex: Type cd command into the Terminal to go to the home directory.

Related Articles

You may like