Strategy_Method/main.py
def calculate_discount(price, occasion=None):
    '''
    Calculates the price of an item after discount.
    '''

    item_price = price

    if occasion == 'Christmas':
        discounted_price = DiscountContext(item_price, strategy='ChristmasStrategy').perform_operation()
    elif occasion == 'Thanksgiving':
        discounted_price = DiscountContext(item_price, strategy='ThanksgivingStrategy').perform_operation()
    elif occasion == 'Normal':
        discounted_price = DiscountContext(item_price, strategy='NormalStrategy').perform_operation()
    else:
        raise ValueError("There are no such occasion!")

    return discounted_price

    Calculates the price of an item after discount.
    
Calculates the price of an item after discount.
Calculates the price of an item after discount .
def calculate_discount(price, occasion=None):
    item_price = price
    if occasion == 'Christmas':
        discounted_price = DiscountContext(item_price, strategy='ChristmasStrategy').perform_operation()
    elif occasion == 'Thanksgiving':
        discounted_price = DiscountContext(item_price, strategy='ThanksgivingStrategy').perform_operation()
    elif occasion == 'Normal':
        discounted_price = DiscountContext(item_price, strategy='NormalStrategy').perform_operation()
    else:
        raise ValueError("There are no such occasion!")
    return discounted_price
def calculate_discount ( price , occasion = None ) : item_price = price if occasion == 'Christmas' : discounted_price = DiscountContext ( item_price , strategy = 'ChristmasStrategy' ) . perform_operation ( ) elif occasion == 'Thanksgiving' : discounted_price = DiscountContext ( item_price , strategy = 'ThanksgivingStrategy' ) . perform_operation ( ) elif occasion == 'Normal' : discounted_price = DiscountContext ( item_price , strategy = 'NormalStrategy' ) . perform_operation ( ) else : raise ValueError ( "There are no such occasion!" ) return discounted_price
Calculates the price of an item after discount.
Calculates the price of an item after discount .
'''
    Calculates the price of an item after discount.
    '''
price
occasion