Variables and Data Types

Variables in Python are used to store data. You don’t need to declare their type — Python infers it automatically.

Creating Variables

name = "Harshal"
age = 21
is_student = True

Common Data Types

  • str – String (e.g., "Hello")
  • int – Integer (e.g., 10)
  • float – Decimal numbers (e.g., 3.14)
  • bool – Boolean (True or False)

Python is dynamically typed, so types are assigned at runtime.

← PrevNext →