0Pricing
Python Academy · Lesson

Numeric and Boolean Types

Explore int, float, and bool data types with practical examples.

Numeric and Boolean Types is a free Python Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Python Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Introduction

Python has several numeric types. int holds whole numbers, float holds decimals, and complex holds complex numbers like 3+2j.

Integer Type

int stores whole numbers of arbitrary size: x = 42. No overflow — Python integers grow as needed.
x = 42
print(type(x))

Float Type

float stores 64-bit decimal values: pi = 3.14159. Beware floating-point precision: 0.1 + 0.2 != 0.3 exactly.

Boolean Type

bool is a subclass of int. True equals 1 and False equals 0. You can do: True + True == 2.
print(True + True)
print(type(False))

Arithmetic Operators

+ - * / // % ** are your numeric operators. // is floor division, ** is exponentiation.
print(7 // 2)  # 3
print(2 ** 10) # 1024

Comparison Operators

== != > < >= <= produce booleans. Use is for identity comparison, not == for booleans.
print(10 > 3)
print(10 == 10)

Logical Operators

and, or, not combine boolean expressions. Python short-circuits: False and anything skips the right side.
print(True and False)
print(not True)

Integer Division vs True Division

5 / 2 gives 2.5 (float). 5 // 2 gives 2 (int). Always be explicit about which you need.
print(5 / 2)
print(5 // 2)

abs(), round(), pow()

abs(-7) gives 7. round(3.567, 2) gives 3.57. pow(2, 8) is equivalent to 2**8.
print(abs(-7))
print(round(3.567, 2))

The math Module

import math gives you math.sqrt(), math.pi, math.ceil(), math.floor() for advanced numeric operations.

Boolean Truthiness

Non-zero numbers, non-empty strings and collections are truthy. 0, 0.0, '', [], {}, None are all falsy.

Quick Check

Which Python operator performs floor division?

Recap

Python numbers: int (arbitrary precision), float (64-bit), bool (True/False). Key operators: // for floor division, ** for power, and logical and/or/not.

Keep Going

Great work! Move on to the next lesson to continue building your skills.

Frequently asked questions

Is the “Numeric and Boolean Types” lesson free?

Yes — the full text of “Numeric and Boolean Types” is free to read here on the web, and the Python Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Python Academy course, upgrade to CoddyKit PRO.

What will I learn in “Numeric and Boolean Types”?

Explore int, float, and bool data types with practical examples. You practise Python Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Python Academy?

No prior experience is required. Python Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Numeric and Boolean Types” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Python Academy lesson?

Yes. Every Python Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Variables and Assignment
  2. Numeric and Boolean Types
  3. Strings and Type Conversion
  4. Reading User Input
← Back to Python Academy