Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
molecular mass
n=(input()) s=[] for i in range(len(n)): if n[i]=='(': s.append(-1) if(n[i] == 'C'): s.append(12) if(n[i] == 'H'): s.append(1) if(n[i] == 'O'): s.append(16) if(n[i] >= '2' and n[i] <= '9'): nn = s[-1] s.pop() s.append(nn * int(n[i])) if n[i]==')': total = 0; while(s[-1] != -1): total += s[-1]; s.pop() s.pop() s.append(total) res = 0 while(len(s)>0): res += s[-1]; s.pop(); print(res)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
My cousin asked for this will never forgive her
134
3-6.격자판 최대합
Lab_III_3_24_11_2020
Encrypt 2
вложенные циклы Квадрат
Christmas tree
PyBatScoreAbs
Lesson 8!
teretere
Please log in to post a comment.