NumPy 使用

Undefined443 / 2024-06-09 / 原文

NumPy 相当于 Python 中的 MATLAB

import numpy as np

# 被除数数组
dividends = np.array([10, 20, 30, 40, 50])

# 除数数组
divisors = np.array([2, 4, 5, 8, 10])

# 计算商
quotients = dividends / divisors

print("被除数数组:", dividends)
print("除数数组:", divisors)
print("商数组:", quotients)