Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.1 kB
3
Indexable
Never
import matplotlib.pyplot as plt

# Constants
ebook_size_mb = 2.5
delivery_fee_rate = 0.15
royalty_rate_70_percent = 0.70
royalty_rate_35_percent = 0.35

# Calculate delivery charge for 70% royalty deal
delivery_charge = ebook_size_mb * delivery_fee_rate

# Calculate profit margins for both royalty deals
prices_70_percent = range(3, 10)
prices_35_percent = range(26)

profit_margins_70_percent = [(price - (delivery_charge + (royalty_rate_70_percent * price))) for price in prices_70_percent]
profit_margins_35_percent = [(price * royalty_rate_35_percent) for price in prices_35_percent]

# Plotting
plt.figure(figsize=(10, 6))

plt.plot(prices_70_percent, profit_margins_70_percent, label="70% Royalty Deal (with delivery charge)")
plt.plot(prices_35_percent, profit_margins_35_percent, label="35% Royalty Deal (no delivery charge)")

plt.xlabel("eBook Price ($)")
plt.ylabel("Profit Margin ($)")
plt.title("Profit Margins for Different eBook Prices")
plt.legend()
plt.grid(True)

plt.xticks(range(0, 26, 1))

plt.show()
Leave a Comment