Skip to content

[New Concept Exercise] : sequences and common sequence operations #2290

Closed
@DavidGerva

Description

@DavidGerva

Note: this issue was ported from the working [V3] repo, and needs to be re-done.

This issue describes how to implement the slicing concept exercise for the Python track.

Getting started

Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:

Goal

The goal of this exercise is to teach the student about the slicing operation in Python and how it applies to various data types.

Learning objectives

  • what is a slice (a copy of a selected subsection).
  • understand slice syntax (e.g. [start : stop : step]), and how Python evaluates slices.
  • understand indexing from the left and the right, and how this applies to slicing.
  • understand which built-in data types & data structures can be sliced, and which cannot. (strings can, numbers cannot).
  • perform slice operations on strings.
  • perform a slice operations on sequence types (lists, sets, & tuples).
  • copy an object via the "full" slice [:]
  • reverse an object order via the "reverse slice" [::-1]

Out of scope

  • slice assignment
  • slice() function, and how it differs from [ ] notation
  • slice objects
  • itertools.islice()

Concepts

  • slicing
  • indexing

Prerequisites

  • basics
  • iteration
  • lists
  • list-methods
  • sets
  • strings
  • tuples

Resources to refer to

Hints

  • TBD?

After

  • the slice() function

Representer

No changes required.

Analyzer

No changes required.

Implementing

Tests should be written using unittest.TestCase and the test file named slicing_test.py.

Help

If you have any questions while implementing the exercise, please post the questions as comments in this issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions