From 3ca7b899e025f7dfb1faa6809a5d71637ba42b5e Mon Sep 17 00:00:00 2001 From: Lawrence Woods Date: Mon, 20 Mar 2017 21:40:46 -0500 Subject: [PATCH] Create fizzbuzz exercise --- woodsl2/fizzbuzz exercise | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 woodsl2/fizzbuzz exercise diff --git a/woodsl2/fizzbuzz exercise b/woodsl2/fizzbuzz exercise new file mode 100644 index 0000000..7933c3c --- /dev/null +++ b/woodsl2/fizzbuzz exercise @@ -0,0 +1,27 @@ +#Lawrence Woods +# coding=utf-8 +# This program pints the numbers between 1 to 100 inclusive. +# But for multiples of three the program prints “Fizz” +# instead of the number. For the multiples of five the program +# prints “Buzz”. For numbers which are multiples of both three and +# five the program prints print “FizzBuzz” instead. + + +fizzbuzz = [] + +start = int(input("Enter Start Value")) +end = int(input("Enter End Value")) + +for i in range(start, end + 1): + entry = '' + if i % 3 == 0: + entry += "fizz" + if i % 5 == 0: + entry += "buzz" + if i % 3 != 0 and i % 5 != 0: + entry = i + + fizzbuzz.append(entry) + +for i in fizzbuzz: + print(i)