## DEV Community is a community of 668,514 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

# Discussion on: Unconditional Challenge: FizzBuzz without `if` Ryan Westlund

Does this count as a secret conditional?

``````def fizzbuzz(n):
d = {(0, 0): 'FizzBuzz', (0, 1): 'Fizz', (0, 2): 'Fizz', (0, 3): 'Fizz', (0, 4): 'Fizz', (1, 0): 'Buzz', (2, 0): 'Buzz'}
return d.get((n % 3, n % 5), str(n))
`````` Nathan Kallman

I think your `.get` is a secret conditional. (It will return the value at the given `key` or the default IF the value is undefined)

If you can show how to implement `.get` without an `if` then I think this is a great answer! Ryan Westlund • Edited

How's this?

``````def fizzbuzz(n):
d = {(0, 0): lambda _: 'FizzBuzz', (0, 1): lambda _: 'Fizz',
(0, 2): lambda _: 'Fizz', (0, 3): lambda _: 'Fizz',
(0, 4): lambda _: 'Fizz', (1, 0): lambda _: 'Buzz',
(2, 0): lambda _: 'Buzz', (1, 1): lambda n: n,
(2, 2): lambda n: n, (1, 2): lambda n: n,
(2, 1): lambda n: n, (1, 3): lambda n: n,
(2, 3): lambda n: n, (1, 4): lambda n: n,
(2, 4): lambda n: n}
return str(d[(n % 3, n % 5)](n))
`````` 