7 kyu

Thinkful - List and Loop Drills: Inverse Slicer

3,003 of 4,457Grae-Drake

Description:

You're familiar with list slicing in Python and know, for example, that:

>>> ages = [12, 14, 63, 72, 55, 24]
>>> ages[2:4]
[63, 72]
>>> ages[2:]
[63, 72, 55, 24]
>>> ages[:3]
[12, 14, 63]

Write a function inverse_slice that takes three arguments: a list items, an integer a and an integer b. The function should return a new list with the slice specified by items[a:b] excluded.

For example:

>>>inverse_slice([12, 14, 63, 72, 55, 24], 2, 4)
[12, 14, 55, 24]
inverse_slice(&[12, 14, 63, 72, 55, 24], 2, 4) == [12, 14, 55, 24]

Input domain:

  • items will always be a valid sequence.
  • b will always be greater than a.
  • a will always be greater than or equal to zero.
  • a will always be less than the length of items.
  • b may be greater than the length of items.
Fundamentals
Lists

Stats:

CreatedJan 5, 2017
PublishedJan 5, 2017
Warriors Trained5894
Total Skips86
Total Code Submissions10674
Total Times Completed4457
Python Completions3003
JavaScript Completions1138
CoffeeScript Completions14
Crystal Completions10
Ruby Completions115
PHP Completions156
Haskell Completions79
Rust Completions114
COBOL Completions5
Scala Completions10
Total Stars52
% of votes with a positive feedback rating92% of 601
Total "Very Satisfied" Votes516
Total "Somewhat Satisfied" Votes69
Total "Not Satisfied" Votes16
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Grae-Drake Avatar
  • coryshrmn Avatar
  • GiacomoSorbi Avatar
  • suic Avatar
  • donaldsebleung Avatar
  • St3f4n Avatar
  • Awesome A.D. Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • Minoru-kun Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • KayleighWasTaken Avatar
Ad