100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

Data Types in Python

A tour of Python's built-in data types — numeric, sequence, mapping, set, boolean, and NoneType — and how mutability affects each.

Basics & Data TypesBeginner10 min readJul 7, 2026
Analogies

1. Introduction

Every value in Python has a data type that determines what operations can be performed on it and how it behaves in memory. Python provides a rich set of built-in data types out of the box — numbers, text, sequences, mappings, sets, booleans, and a special 'no value' type — so you rarely need to build your own basic containers.

🏏

Cricket analogy: Every player on a scorecard has a defined role type—batsman, bowler, all-rounder, wicketkeeper—just as every Python value has a type (int, str, list, dict) that determines what "moves" it can make.

Understanding data types is essential because it affects everything from arithmetic and comparisons to how data is stored, copied, and iterated. Choosing the right data type for a job (e.g., a set for uniqueness checks, a dict for lookups) is a core Python skill.

🏏

Cricket analogy: Choosing a set to track "players who've scored a century this season" avoids duplicate entries, just as a scorer uses a tally sheet (dict) for quick lookups of runs per batsman rather than scanning the whole scorecard.

2. Syntax

python
integer_num = 10          # int
float_num = 10.5          # float
complex_num = 2 + 3j      # complex
string_val = "Python"     # str
bool_val = True           # bool
list_val = [1, 2, 3]      # list
tuple_val = (1, 2, 3)     # tuple
dict_val = {"a": 1}       # dict
set_val = {1, 2, 3}       # set
none_val = None           # NoneType

3. Explanation

Numeric Types

int represents whole numbers of arbitrary precision, float represents decimal numbers using double precision, and complex represents numbers with a real and imaginary part (a + bj). Arithmetic between an int and a float automatically produces a float.

🏏

Cricket analogy: A run tally (int) stays whole, but a batting average like 47.83 (float) has decimals, and just as adding a whole run to a fractional strike rate yields a float, mixing int and float in Python always upgrades to float.

Sequence Types

str, list, and tuple are ordered sequences that support indexing and slicing. Strings and tuples are immutable — once created, their contents cannot change — while lists are mutable and support in-place modification such as append() or item assignment.

🏏

Cricket analogy: A fixed batting lineup announced before the toss is like a tuple—unchangeable once set—while a bowling rotation (list) can be adjusted mid-over with a substitution, just as lists support append() and tuples don't.

Mapping and Set Types

dict stores key-value pairs for fast lookup by key, and is mutable. set stores an unordered collection of unique, hashable values, useful for membership tests and removing duplicates; it is also mutable, though its elements must themselves be immutable.

🏏

Cricket analogy: A dict mapping player names to jersey numbers gives instant lookup, while a set of "teams that have won the World Cup" ensures no team is listed twice, both mutable and updatable each season.

Boolean and None

bool has only two values, True and False, and is technically a subclass of int (True == 1, False == 0). NoneType has a single value, None, representing the intentional absence of a value.

🏏

Cricket analogy: A "won toss" flag being True (which secretly equals 1) is like a scorer treating "yes" as literally 1 run added to a boolean tally, while an unscheduled match shows None—no result recorded at all, not even zero.

Use type(obj) to check an object's exact type, or isinstance(obj, cls) when you want to allow subclasses too (e.g., isinstance(True, int) returns True because bool subclasses int).

Common gotcha: sets and dict keys must contain only hashable (generally immutable) values — trying to put a list inside a set raises TypeError: unhashable type: 'list', because lists are mutable and cannot be hashed.

4. Example

python
integer_num = 10
float_num = 10.5
complex_num = 2 + 3j
string_val = "Python"
bool_val = True
list_val = [1, 2, 3]
tuple_val = (1, 2, 3)
dict_val = {"a": 1, "b": 2}
set_val = {1, 2, 3}
none_val = None

for value in [integer_num, float_num, complex_num, string_val, bool_val,
              list_val, tuple_val, dict_val, set_val, none_val]:
    print(value, "->", type(value))

5. Output

text
10 -> <class 'int'>
10.5 -> <class 'float'>
(2+3j) -> <class 'complex'>
Python -> <class 'str'>
True -> <class 'bool'>
[1, 2, 3] -> <class 'list'>
(1, 2, 3) -> <class 'tuple'>
{'a': 1, 'b': 2} -> <class 'dict'>
{1, 2, 3} -> <class 'set'>
None -> <class 'NoneType'>

6. Key Takeaways

  • Python's core built-in types are int, float, complex, str, bool, list, tuple, dict, set, and NoneType.
  • str, tuple, and frozenset are immutable; list, dict, and set are mutable.
  • bool is a subclass of int, so True behaves like 1 and False like 0 in arithmetic.
  • Only hashable (typically immutable) objects can be set elements or dict keys.
  • Use type() for exact type checks and isinstance() when subclassing matters.
  • None is the single value of NoneType, representing 'no value'.

Practice what you learned

Was this page helpful?

Topics covered

#Python#PythonProgrammingStudyNotes#Programming#DataTypesInPython#Data#Types#Syntax#Explanation#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse