Created
June 5, 2014 15:13
-
-
Save GuillermoPena/69d9080d0011831234e1 to your computer and use it in GitHub Desktop.
CheckIO - Electronic Station Challenge 2 : Restricted sum
This file contains hidden or 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 | |
# for | |
# while | |
# reduce | |
# Input: A list of numbers. | |
# Output: The sum of numbers. | |
# Precondition: The small amount of data. Let's creativity win! | |
def checkio(data): | |
if len(data)==0: return 0 | |
return data[0]+checkio(data[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment