+91 81900 98289

Python Get Started

This Python Get Started lesson is for a beginner. Read the short notes, run each example, then change one name or number and run it again.

Install Python 3 from python.org, then open a terminal and run python --version. You should see a version starting with 3.

On this page you do not need a local install to experiment. Use Try it Yourself, change the code, and press Run.

Example 1: Start here

A local install is still worth having before you write files or install packages.

import sys # load a tool that comes with Python print(sys.version.split()[0]) # split breaks the text into pieces

Example 2: Show the version text

split breaks the version at each dot. The first piece is the major version.

version = "3.12.0" # text print(version.split(".")[0]) # split breaks the text into pieces

Example 3: Check that it starts with 3

startswith answers True or False. You want True before you follow a Python 3 tutorial.

version = "3.12.0" # text print(version.startswith("3")) # True or False

Example 4: Print a next step

The browser runner is enough for these small programs.

print("Next: open Try it Yourself and change the text") # print writes this; the quotes are not shown
A local install is still worth having before you write files or install packages.
Call Now 81900 98289