Setting Up Your Python Environment

Before we jump into writing Python code, we need to make sure your environment is ready. Don’t worry — this part is quick.

Step 1: Check if Python Is Installed

Open your terminal (or Command Prompt on Windows) and type:

python

or

python3

If Python is installed, you’ll see something similar to this:

Python 3.12.3 (main, ... ... ..., 17:47:21) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

If you don’t see anything like that, or your system says “command not found,” you can download Python here:
https://wiki.python.org/moin/BeginnersGuide/Download

Once Python is ready, let’s talk about what you’re looking at.


Meet the Python REPL

The >>> prompt means you are inside Python’s interactive mode, also called the REPL — the Read–Eval–Print Loop.
It reads what you type, evaluates it, prints the result, and waits for the next command.

It’s perfect for testing tiny bits of code without creating a full file.

Let’s try it. Type:

>>> print("Hello World")

If everything is correct, Python will politely respond with:

Hello World REPL

If something strange appears… well, double-check for typos. Make sure your parentheses and quotation marks open and close properly — Python is picky about that.

To exit the REPL:

  • Windows: Ctrl + Z then press Enter
  • Linux/macOS: Ctrl + D
  • Or type exit() or quit()

Reserved Words

These words are part of Python’s language and cannot be used as variable names:

False    class      finally    is         return
None     continue   for        lambda     try
True     def        from       nonlocal   while
and      del        global     not        with
as       elif       if         or         yield
assert   else       import     pass
async    except     in         raise
await
break

Built-in Functions

Here are the functions Python gives you by default:

abs()          aiter()       all()         anext()       any()         ascii()

bin()          bool()        breakpoint()  bytearray()   bytes()

callable()     chr()         classmethod() compile()     complex()

delattr()      dict()        dir()         divmod()

enumerate()    eval()        exec()

filter()       float()       format()      frozenset()

getattr()      globals()

hasattr()      hash()        help()        hex()

id()           input()       int()         isinstance()  issubclass()  iter()

len()          list()        locals()

map()          max()         memoryview()  min()

next()

object()       oct()         open()        ord()

pow()          print()       property()

range()        repr()        reversed()    round()

set()          setattr()     slice()       sorted()       staticmethod()  
str()          sum()         super()

tuple()        type()

vars()

zip()

__import__()

Don’t memorize them — you’ll naturally learn the ones you use most often.


Running “Hello World” From a File

Now let’s move beyond the REPL and run Python code from an actual file.

You can use any text editor you like, but I recommend Visual Studio Code (VSCode). It’s powerful, beginner-friendly, and extremely popular.

Create a new file and write:

print("Hello World")

Save it as hello_world.py.

To run it in a terminal:

python3 hello_world.py

Or, in VSCode, go to:
Run → Run Without Debugging

You should see your shiny Hello World appear again. If you do — congrats! You’ve officially run your first Python program both interactively and from a file. 🎉


Leave a Reply

Your email address will not be published. Required fields are marked *