Run Code
|
API
|
Code Wall
|
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
super and overriding
crown pattern
Swapping.py
PyGuessTheNum2
SceneGraph Interviewee Task
perform_math.py
Ваня и забор
Christmas tree
PyEnDecode
("Hello,world!")