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
items []append()insert()remove() / pop()sort() / sorted()reverse()slicing [a:b]
🗂️ Dictionary & Set
🔁 Condition & Loop
🧩 Function
📁 File & Error
🔄 Type & Conversion
Python›REFERENCE›List›remove() / pop()

remove() / pop()

Removes an element (by value or by position).

Syntax

items.remove(value) · items.pop(index)

Description

remove() deletes the given VALUE (the first match). pop() deletes the element AT the given POSITION and returns it; if no index is given, it takes the last one.

Returns

pop() returns the removed element.

Example

Loading editor…

Expected output

['x']
z

When to use?

Taking a product out of a cart, taking an element from a queue.

Common mistakes

  • ⚠️ remove() throws an error for a value that doesn't exist; check 'value in items' first.

Related commands

append()insert()
← insert()sort() / sorted() →
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