def calc(input):
if len(input) == 0:
return 0
result = 0
for i in input:
if i == '/0':
continue
operator = i[0:1]
num = i[1:]
result = performOperation(result, operator, num)
return result
def performOperation(currentResult, operator, num):
num = int(num)
if operator == '+':
currentResult += num
elif operator == '-':
currentResult -= num
elif operator == '*':
currentResult *= num
elif operator == '/':
currentResult /= num
return currentResult
print(calc(['+1', '+1123', '*2', '/3']))
print(calc(['+1', '+1', '*2', '/3']))
print(calc(['+100', '/2', '*2', '-12']))
print(calc(['-100', '/22', '+12', '+15']))
print(calc(['+100', '/3', '-1', '+25', '/0']))
print(calc(['+1']))
print(calc(['/1']))
print(calc([]))