feat: Added several demo programs

This commit is contained in:
xpk
2025-11-28 08:29:28 +08:00
parent 9d044c20c9
commit 3baa1996c2
4 changed files with 104 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
import numpy as np
celsius_temps = np.array([70, 75, 80])
fahrenheit_temps = (celsius_temps * 9/5) + 32
print(fahrenheit_temps) # [158. 167. 176.]
revenues = np.array([1000, 1500, 800, 2000, 1200])
costs = np.array([600, 900, 500, 1100, 700])
tax_rates = np.array([0.15, 0.18, 0.12, 0.20, 0.16])
gross_profits = revenues - costs
net_profits = gross_profits * (1 - tax_rates)
print(net_profits) # [340. 492. 264. 720. 420.]