HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to Python: Print and RepeatVariablesData Types & NumbersStringsListsConditions (if / elif / else)Loops (for / while)FunctionsOperatorsDictionariesTuples & SetsError Handling (try / except)Classes (Object-Oriented)File OperationsComments & IndentationBooleans (True / False)Lambda & map / filterModules (import)InheritanceVariable Scope
REFERENCE
📖 Overview
🖥️ Output & Input
🔢 Numbers & Math
✍️ String
📋 List
🗂️ Dictionary & Set
🔁 Condition & Loop
if / elif / elseforrange()enumerate()zip()while
🧩 Function
📁 File & Error
🔄 Type & Conversion
Python›REFERENCE›Condition & Loop›range()

range()

Generates a sequence of numbers (used with for).

Syntax

range(start, end, step)

Description

Generates numbers starting at 0 (or at start) up to end (excluded). With a single argument, range(n) → 0..n-1. step is the skip amount.

Example

Loading editor…

Expected output

[0, 1, 2, 3, 4]
[2, 4, 6, 8]

When to use?

A set number of repetitions, looping with an index, number tables.

Common mistakes

  • ⚠️ end is not included: range(1,4) → 1,2,3.

Related commands

forenumerate()
← forenumerate() →
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code