• Use Different Methods Of Joining Strings While Predicting the Future Characters

Hello, checkiomates🐱‍👤!

Learning strings is a neverending story: predict the next characters in a sequence and look under the hood of strings joining.

💡TIP

At your profile, after clicking on big percent number of your progress, you may see module and methods you have already used in your shared solutions. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁MISSION

Sequence Analyzer by freeman_lex -

Consider a sequence of uppercase alphabetic characters (A-Z). The sequence is said to have a "constant step" if the distance between adjacent characters in the sequence is the same. For example, the distance between A and B is 1, D and F is 2, P and V is 6, Z and C is 3 etc. Two or mor sequences are said to be "intertwined" if their adjacent elements are separated by exactly one element of each of the other sequences.

For the given string of 12 characters of 1, 2 or 3 (find out it by yourself) intertwined sequences, return the next 12 character of the sequence.

analyzer("ACEGIKMOQSUW") == "YACEGIKMOQSU"
analyzer("AQBRCSDTEUFV") == "GWHXIYJZKALB"
analyzer("AZTAYRAXPAWN") == "AVLAUJATHASF"

📖ARTICLE

Joining Strings in Python: why str.join() doesn’t like generators. - In the article you may read about comparison and behavior of generators and lists in a task of joining strings.

👩‍💻CODE SHOT

How do you think, what the following code does?

from itertools import groupby

def ?????????(digits: str) -> str:
    
    return "".join(str(len(list(counter))) + current
                   for current, counter in groupby(digits))

🙌 Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! We are really interested in your thoughts! Please, leave a comment below! ⤵

Welcome to CheckiO - games for coders where you can improve your codings skills.

The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.

Join the Game