aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/paulo-custodio/python/ch-2.py
blob: b1ecb29d3525cf2c3f9e8cf84fd9d86561021899 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

# Challenge 001
#
# Challenge #1
# Write a one-liner to solve the FizzBuzz problem and print the numbers 1
# through 20. However, any number divisible by 3 should be replaced by the word
# ‘fizz’ and any divisible by 5 by the word ‘buzz’. Those numbers that are both
# divisible by 3 and 5 become ‘fizzbuzz’.

import sys

for i in range(1, int(sys.argv[1])+1):
    if i%15==0:
        print("fizzbuzz")
    elif i%3==0:
        print("fizz")
    elif i%5==0:
        print("buzz")
    else:
        print(i)