Skip to content

Instantly share code, notes, and snippets.

@fzmaster
Created December 21, 2010 04:29
Show Gist options
  • Save fzmaster/749491 to your computer and use it in GitHub Desktop.
Save fzmaster/749491 to your computer and use it in GitHub Desktop.
Resolução do Problema Coding Kata
import unittest
from welcome import *
class WelcomeTestCase(unittest.TestCase):
def test_Nome_M(self):
assert welcome('John', False, False) == 'Hello Mr. John'
def test_Nome_F(self):
assert welcome('Jane', True, False) == 'Hello Ms. Jane'
def test_Nome_S(self):
assert welcome('John', False, True) == 'Hello Sir John'
if __name__ == '__main__':
unittest.main()
# -*- coding:utf-8 -*-
def welcome(ultimoNome, eMulher, eSir):
"""
Autor: fzmaster
Data: 21/12/2010
Problema: The Tea Party
http://codingkata.org/katas/unit/tea-party
Your task is to welcome your guests properly: Some are female and some were knighted by the queen.
So greet them correctly – or this will be your last hosting.
For example:
-Jane Austen is a women, so say Hello Ms. Austen
-George Orwell is a man, so say Hello Mr. Orwell
-Isaac Newton was knighted, so say Hello Sir Newton
"""
if eMulher == True:
return 'Hello Ms. ' + ultimoNome
else:
if eSir == True:
return 'Hello Sir ' + ultimoNome
else:
return 'Hello Mr. ' + ultimoNome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment