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
print("Hello, World!")
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.
name = "Rafi" age = 23 is_student = True print(name) print(age) print(is_student)
Rafi 23 True
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 —
TrueorFalse - NoneType —
None, Python\'s equivalent of "nothing" or missing
type(10) type(3.14) type("hello") type(True) type(None)
<class 'int'> <class 'float'> <class 'str'> <class 'bool'> <class 'NoneType'>
Comments
# this calculates the area of a circle radius = 5 import math area = math.pi * radius ** 2 # ** is the exponent operator area
78.53981633974483
Getting Help
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, andNone. - Use
type()to check a value's type, andhelp(function_name)to get documentation.