Skip to content

Commit 02adaa5

Browse files
author
yadneshk
authored
Added modulus function
The script is now capable find modulus too
1 parent 544988d commit 02adaa5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

calculator.py

+2-1
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)