检测工具的年末优惠活动通常是指在年底时,相关供应商或服务商为了促销和清仓,提供的一系列折扣、赠品或其他优惠措施。以下是一些基础概念和相关信息:
class Promotion:
def __init__(self, name, discount_rate, start_date, end_date):
self.name = name
self.discount_rate = discount_rate
self.start_date = start_date
self.end_date = end_date
def is_active(self, current_date):
return self.start_date <= current_date <= self.end_date
class Product:
def __init__(self, name, price):
self.name = name
self.price = price
def get_discounted_price(self, promotion):
if promotion.is_active(datetime.now()):
return self.price * (1 - promotion.discount_rate)
return self.price
# 示例使用
from datetime import datetime
product = Product("高级检测仪", 1000)
promotion = Promotion("年末大促", 0.2, datetime(2023, 12, 1), datetime(2023, 12, 31))
print(f"原价: {product.price}")
print(f"优惠价: {product.get_discounted_price(promotion)}")希望这些信息对你有所帮助!如果有更多具体问题,欢迎继续咨询。
没有搜到相关的文章