Hello World! A Python One-Liner to Get Started with Python Quickly

The “hello world program” is used in programming languages to set up a minimal programming environment and execute the first trivial program in it. It helps you get your environment going and take your first steps towards a more complicated program. This short tutorial will show you the fastest possible way to write your first hello world program — as a Python one-liner!

Before I show you how to install Python on your computer, follow the following steps to run your first Python "hello world" program in your browser!

Run Your Hello World One-Liner in Your Browser Shell

Step 1: Here’s an interactive browser-based shell:

The shell runs any Python program in your browser.

Step 2: Type the print function in your browser shell with opening and closing parentheses that are initially empty:

print()

The print() function takes a string and prints it to your shell. This way, you can generate outputs in your program. Think about it: a Python program is only a means to an end. It transform an input to an output. One way of creating an output is to print program values to the shell. In our hello world one-liner, the output is the textual data (=string) 'hello world'.

Step 3: Pass the 'hello world' string into the print() function between the parentheses.

print('hello world')

Congratulations, your first hello world one-liner is ready! Now, there’s only one thing left:

Step 4: Run the hello world one-liner program by hitting the “Run” symbol ▶.

Can you see the output generated by your program? When running your program in the interactive shell, the result should be the following output:

hello world

Make sure that you see this output in your shell before you move on!

Install Python on Your Computer

Now, you know how to run your first program. If you want to start your first serious project though, you’ll need Python on your local machine.

Follow these seven steps to install Python on your computer (Windows):

  1. Visit website “Python Releases for Windows”: https://www.python.org/downloads/windows/
  2. Click link “Download Windows x86-64 executable installer” under “Stable Releases” header.
  3. A popup opens. Click “Save File”.
  4. Wait until the download completes and double click on the installer file to run it.
  5. Another popup appears. Select “Add Python to Path” and click “Install Now”.
  6. Wait until the installation completes “Setup was successful”.
  7. You can now use Python on your Windows computer: use the Windows Search for “IDLE” and open the standard Python editor to start coding.

The steps are almost identical for MacOS and Linux, you can figure them out easily. In this video, I’ll guide you through the process in a step-by-step manner:

Related Article: 7 Steps to Set Up Python on Windows

Learn the Python Basics

An excellent way to start learning Python is through Python cheat sheets. They focus on the relevant parts and introduce the most important concepts in the shortest possible time. Here’s such a Python cheat sheet for you:

Python Ultimate Cheat Sheet

You can download this and more cheat sheets in my interactive Python email course (that’s also 100% free). Check it out for continuous improvement in Python by reading a series of course email lessons I’ll send you into your INBOX. Free Python cheat sheets are included!

*** Join FREE Python Cheat Sheet Email Academy ***

Author: admin

Leave a Reply

Your email address will not be published.