Created
August 5, 2020 17:10
-
-
Save Sn3akyP3t3/f571c4baf272db191ed59f03359795c0 to your computer and use it in GitHub Desktop.
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
import fire | |
import random | |
class ProcessClass(object): | |
def __init__(self): | |
self.pizza = '' | |
def orderUp(self, HowMuchPizza, TipAmount): | |
''' | |
Dishes up the appropriate amount of pizza. | |
Args: | |
HowMuchPizza : string | |
How much pizza do you want?. 0.5 or 1 are the options. If 0.5 don't ask what the delivery guy did with the other half! | |
''' | |
if(HowMuchPizza < 1.0): | |
if(round(random.random()) == 1): | |
self.secondHalfPizza() | |
else: | |
self.firstHalfPizza() | |
elif HowMuchPizza == 1.0: | |
self.firstHalfPizza() | |
self.secondHalfPizza() | |
else: | |
print("Don't be greedy!") | |
self.gimmePizza() | |
if(TipAmount): | |
print('Woohoo! Much appreciated! I can finally get that game everyone is talking about!') | |
def firstHalfPizza(self): | |
self.pizza += '(' | |
def secondHalfPizza(self): | |
self.pizza += ')' | |
def gimmePizza(self): | |
print(self.pizza) | |
class IntegrationClass(): | |
# This class just does the work with adequate abstraction to the underlying class being utilized. | |
def __init__(self, HowMuchPizza, TipAmount=None): | |
''' | |
Pizza lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ante nisl, | |
egestas non sem eget, iaculis pharetra diam. Nulla ac felis tincidunt, ullamcorper | |
odio a, tristique justo. Mauris a porttitor elit. Cras varius interdum metus, eu dapibus | |
erat faucibus sed. Integer semper fringilla turpis vel luctus. Proin dictum ipsum sed odio | |
elementum dignissim. Mauris convallis rutrum bibendum. Phasellus malesuada ipsum nec urna | |
ullamcorper congue. Integer vel libero ipsum. | |
Args: | |
HowMuchPizza : string | |
How much pizza do you want?. 0.5 or 1 are the options. If 0.5 don't ask what the delivery guy did with the other half! | |
TipAmount : string | |
Optional - Nobody tips the delivery guy extra so don't feel too bad. We're including this in the cost for delivery now anyway :) | |
''' | |
pc = ProcessClass() | |
pc.orderUp(HowMuchPizza, TipAmount) | |
def main(): | |
fire.Fire(IntegrationClass) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment