Demo entry 6655547

FizzBuzz

   

Submitted by anonymous on Oct 27, 2017 at 04:25
Language: Python 3. Code size: 369 Bytes.

mod_dict = {
    3 : 'fizz',
    5 : 'buzz',
}

def check_remainder(number):
    keys = list(mod_dict.keys())
    out = ''
    for i in range(len(mod_dict)):
        if number%keys[i] == 0:
            out = out +mod_dict[keys[i]]
    if out == '':
        return number
    else:
        return out

for i in range(1,11):
    print(check_remainder(i))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).