某化合物CnHnOn由C、H、O三種元素組成,已知C的相對(duì)原子質(zhì)量為12,H的相對(duì)原子質(zhì)量為1,O的相對(duì)原子質(zhì)量為16。某元素的質(zhì)量分?jǐn)?shù)=(該元素的相對(duì)原子質(zhì)量*該元素的原子個(gè)數(shù))/該化合物的相對(duì)分子質(zhì)量,請(qǐng)將實(shí)現(xiàn)上述功能的代碼補(bǔ)充完整。
a=input(“請(qǐng)輸入化合物:“)
dic={'C':12,'c':12,'H':1,'h':1,'O':16,'o':16}
sum=①
dic['c']*int(a[1])或者dic['C']*int(a[1])
dic['c']*int(a[1])或者dic['C']*int(a[1])
sum_total=②dic['c']*int(a[1])+dic['h']*int(a[3])+dic['o']*int(a[5])或者dic['C']*int(a[1])+dic['H']*int(a[3])+dic['O']*int(a[5])
dic['c']*int(a[1])+dic['h']*int(a[3])+dic['o']*int(a[5])或者dic['C']*int(a[1])+dic['H']*int(a[3])+dic['O']*int(a[5])
result=sum/sum_total
print('C元素的質(zhì)量分?jǐn)?shù)為:',result)