This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - O'Reilly Challenge 2 : Ghost Age | |
# http://checkio.org | |
# Nicola takes a moment to study the ghosts. | |
# He is trying to think up a new method to determine just how old these ghosts are. | |
# He knows that their age is somehow related to their opacity. | |
# To measure their opacity Nikola uses a scale of 10000 units to 0 units, | |
# where 10000 is a completely opaque newborn ghost (0 years old) and 0 is completely transparent. | |
# After some experimenting, Nikola thinks he has discovered the law of ghostly opacity. | |
# On every birthday, a ghost's opacity is reduced by a number of units |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Electronic Station Challenge 4 : Find Sequence | |
# http://checkio.org | |
# You are given a matrix of NxN (4≤N≤10). | |
# You should check if there is a sequence of 4 or more matching digits. | |
# The sequence may be positioned horizontally, vertically or diagonally (NW-SE or NE-SW diagonals). | |
# Input: A list of lists. Each list contains integers. | |
# Output: A boolean. Whether or not a sequence exists. | |
# Precondition: 0≤N≤10 ∀ x ∈ matrix : 0 < x < 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Electronic Station Challenge 3 : Hamming Distance | |
# http://checkio.org | |
# The Hamming distance between two binary integers is the number of bit positions that differs | |
# For example: | |
# | |
# 117 = 0 1 1 1 0 1 0 1 | |
# 17 = 0 0 0 1 0 0 0 1 | |
# H = 0+1+1+0+0+1+0+0 = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Electronic Station Challenge 2 : Brackets | |
# http://checkio.org | |
# Our new calculator is censored and as such it does not accept certain words. | |
# You should try to trick by writing a program to calculate the sum of numbers. | |
# Given a list of numbers, you should find the sum of these numbers. | |
# Your solution should not contain any of the banned words, even as a part of another word. | |
# The list of banned words are as follows: | |
# sum | |
# import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Electronic Station Challenge 1 : Brackets | |
# http://checkio.org | |
# You are given an expression with numbers, brackets and operators. | |
# For this task only the brackets matter. Brackets come in three flavors: "{}" "()" or "[]". | |
# Brackets are used to determine scope or to restrict some expression. | |
# If a bracket is open, then it must be closed with a closing bracket of the same type. | |
# The scope of a bracket must not intersected by another bracket. | |
# For this task, you should to make a decision to correct an expression or not based on the brackets. | |
# Do not worry about operators and operands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - O'Reilly Challenge 1 : Striped Words | |
# http://checkio.org | |
# You are given a block of text with different words. | |
# These words are separated by white-spaces and punctuation marks. | |
# Numbers are not considered words in this mission (a mix of letters and digits is not a word either). | |
# You should count the number of words (striped words) where the vowels with consonants are alternating, that is; | |
# words that you count cannot have two consecutive vowels or consonants. | |
# The words consisting of a single letter are not striped -- do not count those. | |
# Input: A text as a string (unicode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Home Challenge 11 : Open Labyrinth | |
# http://checkio.org | |
# The labyrinth has no walls, but pits surround the path on each side. | |
# If a players falls into a pit, they lose. | |
# The labyrinth is presented as a matrix (a list of lists): 1 is a pit and 0 is part of the path. | |
# The labyrinth's size is 12 x 12 and the outer cells are also pits. | |
# Players start at cell (1,1). The exit is at cell (10,10). | |
# You need to find a route through the labyrinth. | |
# Input: A labyrinth map as a list of lists with 1 and 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Home Challenge 10 : Golden Pyramid (algorithm B) | |
# http://checkio.org | |
# Consider a tuple of tuples in which the first tuple has one integer | |
# and each consecutive tuple has one more integer then the last. | |
# Such a tuple of tuples would look like a triangle. | |
# You should write a program that will help Stephan find the highest possible sum | |
# on the most profitable route down the pyramid. | |
# All routes down the pyramid involve stepping down and to the left or down and to the right. | |
# Input: A pyramid as a tuple of tuples. Each tuple contains integers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Home Challenge 10 : Golden Pyramid (algorithm A) | |
# http://checkio.org | |
# Consider a tuple of tuples in which the first tuple has one integer | |
# and each consecutive tuple has one more integer then the last. | |
# Such a tuple of tuples would look like a triangle. | |
# You should write a program that will help Stephan find the highest possible sum | |
# on the most profitable route down the pyramid. | |
# All routes down the pyramid involve stepping down and to the left or down and to the right. | |
# Input: A pyramid as a tuple of tuples. Each tuple contains integers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CheckIO - Home Challenge 9 : Min and Max | |
# http://checkio.org | |
# In this mission you should write you own py3 realisation of the built-in functions min and max. | |
# Some builtin functions are closed here: import, eval, exec, globals. | |
# Don't forget you should realize two functions in your code. | |
# max(iterable, *[, key]) or min(iterable, *[, key]) | |
# max(arg1, arg2, *args[, key]) or min(arg1, arg2, *args[, key]) | |
# Return the largest (smallest) item in an iterable or the largest(smallest) of two or more arguments. | |
# If one positional argument is provided, it should be an iterable. |
NewerOlder