12345678910111213141516171819202122232425262728 |
- import re
- s=[]
- o1=raw_input()
- s.append(o1)
- for i in range(1,10):
- o2=raw_input()
- if o2 != '=':
- o3=list(o2)
- o4=s+o3
- else:
- break
- if '+' in o4:
- a=o4.index('+')
- elif '-' in o4:
- a=o4.index('-')
- elif '*' in o4:
- a=o4.index('*')
- elif '/' in o4:
- a=o4.index('/')
- if o4[a] == '+':
- o=float(o4[a-2])+float(o4[a-1])
- elif o4[a] == '-':
- o=float(o4[a-2])-float(o4[a-1])
- elif o4[a] == '*':
- o=float(o4[a-2])*float(o4[a-1])
- elif o4[a] == '/':
- o=float(o4[a-2])/float(o4[a-1])
- print o
|