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

 

first_middle_last


Write a function that takes a string as a parameter and returns the first, middle and last characters concatenated. If the string is of even length, return the first, middle two and last characters. The string is guaranteed to have enough characters.


first_middle_last('Python') → 'Pthn'
first_middle_last('Guido') → 'Gio'
first_middle_last('Java') → 'Java'

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

def first_middle_last(s):

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 Post-solution available

Copyright Nick Parlante 2017 - privacy