Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Simandl
committed
Apr 8, 2015
1 parent
05a900e
commit 1b1e4ca
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
bower_components/ | ||
.idea | ||
__pycache__ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
def fizz_buzz_wonder(input_func): | ||
user_input = input_func() | ||
if user_input.lower() == 'fizz': | ||
return 'Fizz!' | ||
elif user_input.lower() == 'buzz': | ||
return 'Buzz!' | ||
else: | ||
return 'FizzBuzz!' | ||
|
||
def prompt_for_input(): | ||
return input('Enter "Fizz" or "Buzz": ').strip() | ||
|
||
if __name__ == '__main__': | ||
print(fizz_buzz_wonder(prompt_for_input)) | ||
print("Did I get the job?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__author__ = 'dsimandl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import unittest | ||
import fizzbuzz | ||
|
||
# We have to have tests naturally | ||
|
||
class FizzBuzzTest(unittest.TestCase): | ||
|
||
def test_some_fizz(self): | ||
self.assertEqual(fizzbuzz.fizz_buzz_wonder(lambda: 'Fizz'), 'Fizz!') | ||
|
||
def test_some_buzz(self): | ||
self.assertEqual(fizzbuzz.fizz_buzz_wonder(lambda: 'Buzz'), 'Buzz!') | ||
|
||
def test_some_fizz_buzz(self): | ||
self.assertEqual(fizzbuzz.fizz_buzz_wonder(lambda: 'Hi!'), 'FizzBuzz!') |