Learn Python Programming  /  Getting Started  /  Introduction

Introduction

Python is a free, general-purpose programming language known for clean, readable syntax. This page gets you from zero to writing and understanding your first Python code, with a focus on the data-analysis side of the language.

What Is Python?

Python is one of the most widely used programming languages in the world — used for web development, automation, and especially data science, thanks to libraries like NumPy, pandas, and Matplotlib. Its syntax reads almost like plain English, which is a big part of why it is a popular first language.

You can install Python for free from python.org, though most data-analysis work today happens inside Jupyter Notebook or an editor like VS Code — both free and beginner-friendly.

Your First Line of Python Code

R Code
print("Hello, World!")
Output
Hello, World!

Unlike R, Python does not print the value automatically just from typing a variable name in a script — print() is what actually displays output (in an interactive shell or Jupyter cell, typing a bare variable name does still show its value).

Variables and Assignment

Python uses a single = for assignment. There is no separate "assignment arrow" like in R.

R Code
name = "Rafi"
age = 23
is_student = True

print(name)
print(age)
print(is_student)
Output
Rafi
23
True
💡 Tip
Python is case-sensitive and True/False are capitalised - typing true or false in lower-case raises a NameError. This trips up beginners coming from languages that use lower-case true/false.

Basic Data Types

  • int — whole numbers, e.g. 10
  • float — decimal numbers, e.g. 3.14
  • str — text, in single or double quotes, e.g. "hello"
  • bool — True or False
  • NoneType — None, Python\'s equivalent of "nothing" or missing
R Code
type(10)
type(3.14)
type("hello")
type(True)
type(None)
Output
<class 'int'>
<class 'float'>
<class 'str'>
<class 'bool'>
<class 'NoneType'>

Comments

R Code
# this calculates the area of a circle
radius = 5
import math
area = math.pi * radius ** 2   # ** is the exponent operator
area
Output
78.53981633974483

Getting Help

R Code
help(round)   # opens documentation for round()
dir(str)      # lists every method available on strings

Key Points

  • Python uses a single = for assignment and is case-sensitive throughout.
  • Core types are int, float, str, bool, and None.
  • Use type() to check a value's type, and help(function_name) to get documentation.