Skip to content

Instantly share code, notes, and snippets.

View GuillermoPena's full-sized avatar

Guillermo Peña GuillermoPena

  • Green Box Software
  • Madrid, Spain
View GitHub Profile
@GuillermoPena
GuillermoPena / checkio.1.06.speechModule.py
Created May 28, 2014 11:02
CheckIO - Home Challenge 6 : Speech Module
# CheckIO - Home Challenge 6 : Speech Module
# http://checkio.org
# Stephen's speech module is broken. This module is responsible for his number pronunciation.
# He has to click to input all of the numerical digits in a figure, so when there are big numbers it can take him a long time.
# Help the robot to speak properly and increase his number processing speed by writing a new speech module for him.
# All the words in the string must be separated by exactly one space character.
# Be careful with spaces -- it's hard to see if you place two spaces instead one.
# Input: A number as an integer.
# Output: The string representation of the number as a string.
@GuillermoPena
GuillermoPena / checkio.1.07.feedPingueons.py
Created May 28, 2014 11:32
CheckIO - Home Challenge 7 : Feed Pingeons
# CheckIO - Home Challenge 7 : Feed Pingeons
# http://checkio.org
# I start to feed one of the pigeons.
# A minute later two more fly by and a minute after that another 3.
# Then 4, and so on (Ex: 1+2+3+4+...).
# One portion of food lasts a pigeon for a minute, but in case there's not enough food for all the birds,
# the pigeons who arrived first ate first.
# Pigeons are hungry animals and eat without knowing when to stop.
# If I have N portions of bird feed, how many pigeons will be fed with at least one portion of wheat?
@GuillermoPena
GuillermoPena / checkio.1.08.romanNumerals.py
Created May 28, 2014 14:17
CheckIO - Home Challenge 8 : Roman Numerals
# CheckIO - Home Challenge 8 : Roman Numerals
# http://checkio.org
# Roman numerals come from the ancient Roman numbering system.
# They are based on specific letters of the alphabet which are combined
# to signify the sum (or, in some cases, the difference) of their values.
# The Roman numeral system is decimal based but not directly positional and does not include a zero.
# Roman numerals are based on combinations of these seven symbols:
# Symbol Value
# I 1 (unus)
@GuillermoPena
GuillermoPena / checkio.1.09.MinAndMax.py
Created May 28, 2014 17:39
CheckIO - Home Challenge 9 : Min and Max
# 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.
@GuillermoPena
GuillermoPena / checkio.1.10a.goldenPyramid.py
Last active August 29, 2015 14:01
CheckIO - Home Challenge 10 : Golden Pyramid (algorithm A)
# 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.
@GuillermoPena
GuillermoPena / checkio.1.10b.goldenPyramid.py
Created June 1, 2014 19:42
CheckIO - Home Challenge 10 : Golden Pyramid (algorithm B)
# 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.
@GuillermoPena
GuillermoPena / checkio.1.11.openLabyrinth.py
Created June 2, 2014 12:39
CheckIO - Home Challenge 11 : Open Labyrinth
# 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.
@GuillermoPena
GuillermoPena / checkio.2.01.stripedWords.py
Created June 5, 2014 10:32
CheckIO - O'Reilly Challenge 1 : Striped Words
# 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)
@GuillermoPena
GuillermoPena / checkio.3.01.brackets.py
Created June 5, 2014 14:34
CheckIO - Electronic Station Challenge 1 : Brackets
# 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.
@GuillermoPena
GuillermoPena / checkio.3.02.restrictedSum.py
Created June 5, 2014 15:13
CheckIO - Electronic Station Challenge 2 : Restricted sum
# 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