Skip to content

Commit 9d4802e

Browse files
Merge pull request #194 from yadneshk/master
Added modulus function
2 parents 32b98c1 + 02adaa5 commit 9d4802e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

calculator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def main():
2525

2626
def calc(k):
2727

28-
functions = ['sin', 'cos', 'tan', 'sqrt', 'pi']
28+
functions = ['sin', 'cos', 'tan', 'sqrt', 'pi','mod']
2929

3030
for i in functions:
3131
if i in k.lower():
@@ -50,6 +50,7 @@ def result(k):
5050
k = k.replace('=', '')
5151
k = k.replace('?', '')
5252
k = k.replace('%', '/100')
53+
k = k.replace('mod', '%')
5354

5455
print("\n" + str(calc(k)))
5556

0 commit comments

Comments
 (0)