Skip to content

Instantly share code, notes, and snippets.

@weburnit
Last active February 14, 2017 09:03
Show Gist options
  • Save weburnit/36057a5c83a9948c7df1b599c3a0bbfa to your computer and use it in GitHub Desktop.
Save weburnit/36057a5c83a9948c7df1b599c3a0bbfa to your computer and use it in GitHub Desktop.
Wizeline Test in Python
class Wizeline(object):
def printNumbers(self, rangeNumber):
for number in range(1, rangeNumber):
self.printNumber(number)
def printNumber(self, number):
mod = self.getMod(number)
result = {
'15': lambda x: 'WizeLine',
'5': lambda x: 'Line',
'3': lambda x: 'Wize',
'0': lambda x: x
}
print result[mod](number)
def getMod(self, number):
if number%15 == 0 :
return '15'
if number%5 == 0 :
return '5'
if number%3 == 0 :
return '3'
return '0'
tellme = Wizeline();
tellme.printNumbers(100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment