
(1)请在划线处填入合适的代码。
def xtod(s2): #转换成十进制数
if s2[-1]=="B":
n=2
elif s2[-1]=="D":
n=10
elif s2[-1]=="H":
m=0
for i in range(len(s2)-1):
c=s2[i]
if"0"<=c<="9":
a=ord(c)-ord("0")#ord()函数:返回字符对应的ASCII值
elif "A"<=c<="F":
a=ord(c)-ord("A")+10
m=m*n+a
s=input("请输入运算式:")
result=0;s1=""
for i in range(len(s)):
c=s[i]
if c=="+" or c=="=":
s1=""
else:
s1+=c
print("运算结果为:"+str(result)+"D")
(2)若输入运算式是"10B+11D+12H=",则运算后十进制的结果为

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

