Skip to content

Instantly share code, notes, and snippets.

@noahingh
noahingh / replace_if_else_statement.py
Last active May 3, 2019 06:37
Replacing if-else statement with pattern.
# Question
# Replace if-else statement with design pattern.
def get_prize(sport, medal):
"""
Return the prize which is depends on sport and medal.
parameters are sport and medal.
'sport' parameter can be any sport in the list of Olympic Sports.
(Currently, there are 2 and the list is subject to change in the future.)
'medal' parameter can be of the following colors: 'Gold', 'Silver' or 'Bronze'.