(1)若某订单码为″g1-A2B11C17,g2-A8B19C23″,则该订单一天住宿的总金额为
(2)实现上述功能的部分Python程序如下,请在划线处填入合适的代码。
def fi(s,b,e):
income=0
i=b
while i<=e:
if s[i]=="A":
income+=
i+=2
elif s[i]=="B":
income+=int(s[i+1:i+3])*300
i+=3
elif s[i]=="C":
income+=int(s[i+1:i+3])*200
i+=3
return income
s=input("请输入订单码:")
flag=False
for i in range(len(s)):
if s[i]=="-"and not flag:
flag=True
elif s[i]=="-":
q=i
elif s[i]==",":
e=i
total=fi(s,p+1,e-1)
total+=fi(s,
print(total)

同类型试题

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

