From f0b6b5527396c37dd28cf8a0e2a1772eefa64699 Mon Sep 17 00:00:00 2001 From: Roland Pangu Date: Wed, 6 Jan 2016 09:37:44 -0700 Subject: [PATCH] Added shortest Fizz buzz python solution --- solutions/python/shortest-fizz-buzz.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 solutions/python/shortest-fizz-buzz.py diff --git a/solutions/python/shortest-fizz-buzz.py b/solutions/python/shortest-fizz-buzz.py new file mode 100644 index 0000000..3f33e79 --- /dev/null +++ b/solutions/python/shortest-fizz-buzz.py @@ -0,0 +1,12 @@ +def shortest_fizz_buz(): + for i in xrange(0, 100): + s = '' + ss = False + if ((i + 1) % 3 == 0): + s +='Fizz' + if ((i + 1) % 5 == 0): + s +='Buzz' + if ((i + 1) % 3 > 0 and (i + 1) % 5 > 0): + print(i + 1) + else: + print(s)