Files
task-3-2-1-Text-Processing-…/1.py
2509165004 be0a8b60c9 完成作业“
;
2026-04-21 11:21:47 +08:00

17 lines
308 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import numpy as np
# 定义向量
A = np.array([3, 4])
B = np.array([1, 2])
# 1. 计算A + B
add_result = A + B
print("A + B =", add_result)
# 2. 计算2 × A
mul_result = 2 * A
print("2 × A =", mul_result)
# 3. 计算A的长度
norm_A = np.linalg.norm(A)
print("A的长度 =", norm_A)