Introduction

Hello and welcome to our exciting exploration of Python strings! For today's lesson, we've prepared something quite unique: you will learn how to select characters from a string in an order that might initially seem a bit strange but is certainly interesting. We will explain it in such a comprehensive and concise way that you'll master it in no time. Let's get started!

Task Statement

Imagine this: You are given a string, and you need to go through it and pick its characters, but the order in which you pick them is unusual. You start with the first character, then jump to the last character, move to the second character, then to the second-to-last character, and carry on in this pattern until you run out of characters. Sounds interesting, isn't it?

Here's what we mean:

You are tasked with writing a Python function, solution(inputString). This function will take inputString as a parameter, a string composed of lowercase English alphabet letters ('a' to 'z') with a length anywhere between 1 to 100 characters. The function will then return a new string, which is derived from the input string but with characters selected in the order we just discussed.

For example, if the inputString is "abcdefg", the function should return "agbfced".

Solution Building: Step 1 - Initialization
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal