Easter Programming: How To Install Python on Windows And Try This Hello World Script

Python Indentation Error_ll Want to try a new programming language? Here’s how to quickly install Python on Windows and write your first Hello World script

Why Python

Python is a great programming language. It’s not as easy to learn as HTML or CSS, but will allow you to create much more sophisticated programs and even web services. It’s a good practice to start with something fun to learn a programming language and its syntax e.g. creating a web scraper to collect data or writing a simple REST web service that returns “hello world”.

But to keep it real simple, let’s tart with the Hello World to get you started right away:

Download And Installation

1. Step Head over to http://www.activestate.com/activepython/downloads

2. Step Depending on your Windows 7 or Windows 8 OS, either 32-bit or 64-bit download will be the right for you. Not sure? Open the Control Panel and click on System to check your OS

Downloading Active Python Community Edition.png

3. Step Follow the install wizard – by default it will install Python to C:\Python27 – you can change that if you develop somewhere else on your HDD

4. Step Confirm the UAC prompt – you have now successfully installed python and all .py files will automatically open with Python

Python Hello World Example

1. Step Now open a command prompt (hit Windows key + R and enter cmd.exe, hit Enter)

2. Step Open the Windows explorer, create a new text document and paste the following code into it:

print("Hello, World!")

3. Step Save the file and call it hello.py or if you saved it already, change the .txt extension to .py (confirm the prompt)

4. Step Now go back to the command prompt window and use the CD command to change the directory to the location where you stored that .py file e.g. cd C:\scripts\python

5. Step You may have to enter D: to change the drive (on a single line, then hit Enter)

6. Step Now enter python hello.py and you should get a response that greets you

Indentation Error

If you followed the Hello World example from another site it’s possible you are running into an indentation error, because Python 2.7 and higher uses a function for printing stuff.

Python Indentation Error.png

If you run into this problem follow our example above. If you want to use an old version of Python (not recommended), then try this code

print 'Hello, World!'

Python Tutorials

You can find useful Python tutorials here that will help you to quickly learn this language – if you are familiar with other programming languages this should be as easy as cake

Alternative Solutions: Auto-Repair Your PC And Drivers

Still Having Trouble? Try TWEAKBIT FIXMYPC - FREE

Published: Sunday, April 5th, 2015 Last Modified: April 5, 2015

Related Posts

Rate This Article
5 of 5 0 (100%) 1 vote