Skip to content

Commit c4f9a77

Browse files
authored
Update evaluate_math_string.py
1 parent 906a424 commit c4f9a77

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

evaluate_math_string.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
# -*- coding: utf-8 -*-
2-
"""Evaluate Math String.ipynb
3-
4-
Automatically generated by Colab.
5-
6-
Original file is located at
7-
https://colab.research.google.com/drive/1MKL7Spf2NpQzo_aspdM2XM0rv9B6eBHZ
8-
"""
9-
101
# Following Code will evaluate the math equation written in a string
2+
113
def evaluate(expression):
124
for equation in expression:
135
if len(equation)>1 and len(equation)<=100:
@@ -21,4 +13,4 @@ def evaluate(expression):
2113
result = eval(equation)
2214
print(float(result))
2315

24-
evaluate(["5 plus ( 3 times 2 )", "2 plus ( 5 times 6 )"])
16+
evaluate(["5 plus ( 3 times 2 )", "2 plus ( 5 times 6 )"])

0 commit comments

Comments
 (0)