Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Variables and Data Types
tutorial

Variables and Data Types

In Python, a variable is like a labeled box where you store a value. You can change what’s inside the box later. Python has several basic data types: integers (whole numbers), floats (decimals), strings (text), and booleans (True/False).

Variables store data; data types define what kind of data (number, text, etc.).

Creating Variables

You don’t need to declare a type – Python figures it out automatically.
age = 25 # integer
price = 19.99 # float
name = "AI Assistant" # string
is_ready = True # boolean

Data Types Explained

  • int: Whole numbers (e.g., -10, 0, 42).
  • float: Decimal numbers (e.g., 3.14, -0.001).
  • str: Text enclosed in quotes (single or double).
  • bool: True or False (used in conditions).
  • list: Ordered collection of items: [1,2,3].
  • dict: Key‑value pairs: {"name": "AI"}.

Why Data Types Matter in AI

AI data comes as numbers (arrays), text (strings), and labels (booleans). Understanding types helps you clean and transform data correctly.

# Check the type of a variable
print(type(age)) #
print(type(name)) #

Simple Operations

x = 10
y = 3
print(x + y) # 13
print(x * y) # 30
print(x / y) # 3.333...
print(x // y) # 3 (integer division)

Two Minute Drill

  • Variables store data; no need to declare type.
  • Common types: int, float, str, bool, list, dict.
  • Use type() to check type.
  • Arithmetic: +, -, *, /, //, %.
Two Minute Drill
  • Variables store data; no need to declare type.
  • Common types: int, float, str, bool, list, dict.
  • Use type() to check type.
  • Arithmetic: +, -, *, /, //, %.

Need more clarification?

Drop us an email at career@quipoinfotech.com