• Fibonacci sequence's dedicated material ans easy type hints.

Hello, checkiomates🐱‍👤!

New week new missions and articles! Today's missions are dedicated to Fibonacci sequence (🐚, 1, 1, 2, 3, 5, ...it's infinite actually, so I' am not going to proceed!😋). Two missions are totally new and one may be known to you. There are also three articles - about Fibonacci sequence, some general recommendations concerning sequences and about type hints! So, you are welcome to solve and read! 🏃‍♂️

🏁 MISSIONS:

Fibonacci Poem by freeman_lex - Split a given text into multiline one with "\n", where each line includes number of words equal to the current Fibonacci number. Let's look at the schematic example ("w" for a word):
"w w w w w w w w" -> ''w
                   w
                   w w
                   w w w
                   w  _  _  _  _''

fibo_poem("") == ""
fibo_poem("Django framework") == "Django\nframework"
fibo_poem("Zen of Python") == "Zen\nof\nPython _"

Fibonacci Spiral's End by freeman_lex - I believe, you have heard about Fibonacci numbers, which form a respective sequence, where each number is the sum of the two preceding ones. So, for the given sequence number, your function should return the coordinates [x, y] of the end of the spiral (square corner) for the respective Fibonacci number.

fibo_spiral_end(0) == [0, 0]
fibo_spiral_end(1) == [1, -1]
fibo_spiral_end(2) == [2, 0]

Ghosts Age by bryukh - In this mission you need to determine the age of a ghost based on its opacity! A scale of 10000 units to 0 units is used, where 10000 is a completely opaque newborn ghost (0 years old) and 0 is completely transparent ghost (of an unknown age). On every birthday, a ghost's opacity is reduced by a number of units equal to its age when its age is a Fibonacci number or increased by 1 if it is not.

checkio(9994) == 3
checkio(9995) == 4
checkio(9990) == 5

Close look to the articles I mentioned!

💡ARTICLES:

A Python Guide to the Fibonacci Sequence - The Fibonacci sequence is a pretty famous sequence of integer numbers. The sequence comes up naturally in many problems and has a nice recursive definition. Learning how to generate it is an essential step in the pragmatic programmer’s journey toward mastering recursion. In this tutorial, you’ll focus on learning what the Fibonacci sequence is and how to generate it using Python.

5 Advanced Tips on Python Sequences - The major takeaways from chapter 2 of Fluent Python by Luciano Ramalho, which covers widely used instruments: sequences e.g. lists, tuples, etc.

Get started with type hints in Python - Type hints help you make your Python code more explicit about the types of the things you're working with. They've been a huge productivity booster for me. If you're familiar with basic Python — control flow, functions, classes — this will bring you up to speed in no time.

A bit of humour at the end!

🙌 Thanks for your attention! Hope to meet you at CheckiO. 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