Last active
February 14, 2017 09:03
-
-
Save weburnit/36057a5c83a9948c7df1b599c3a0bbfa to your computer and use it in GitHub Desktop.
Wizeline Test in Python
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
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