id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

middle


Complete the function so that x is inserted into the middle of the list. nums will have a positive, even length. The function returns the list with x in the middle.


middle([12, 1, 50, 2], 3) → [12, 1, 3, 50, 2]
middle([17, 5], 2) → [17, 2, 5]
middle([3, 3, 3, 3, 3, 3], 8) → [3, 3, 3, 8, 3, 3, 3]

...Save, Compile, Run (ctrl-enter)

def middle( nums, x ):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 200

Copyright Nick Parlante 2017 - privacy