Files
task-3-2-1-Text-Processing-…/260421-2509165027.py
2026-04-21 11:30:31 +08:00

18 lines
378 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.

#题目1
text="Hello"
print(f"字符串'{text}'中的每个字符的ASCII码如下")
for ch in text :
print(f"字符'{char}':{ascii_val}")
#题目3
import math
A=[3,4]
B=[1,2]
A_plus_B=[A[0]+B[0],A[1]+B[1]]
print("1. A+B=",A_plus_B)
two_times_A=[2*A[0],2*A[1]]
print("2. 2*A=",two_times_A)
length_A=math.sqrt(A[0]**2+A[1]**2)
print("3. |A|=",length_A)