Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Smart_Calculator/calculator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from tkinter import *
PI = 3.14159


def add(a,b):
return a + b
Expand Down Expand Up @@ -58,6 +60,21 @@ def calculate():
list.delete(0,END)
list.insert(END,'something went wrong please enter again')


def fact(n):
if n == 1 or n == 0:
return 1
return n * fact(n - 1)


def circle_area(radius):
return PI * (radius ** 2)


def circle_perimeter(radius):
return PI * radius * 2


operations = {'ADD':add,'ADDITION':add, 'SUM':add, 'PLUS':add,
'SUB':sub, 'DIFFERENCE':sub, 'MINUS': sub, 'SUBTRACT':sub, 'DIFF':sub,
'LCM':lcm, 'HCF':hcf, 'PRODUCT':mul, 'MULTIPLICATION':mul,
Expand Down
2 changes: 1 addition & 1 deletion Smart_Calculator/calculator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def test_hcf_function(self):
self.assertEqual(hcf(54, 24), 6)

if __name__ == '__main__':
unittest.main(verbosity=2)
unittest.main(verbosity=2)
7 changes: 6 additions & 1 deletion Triangle Calculator/TriangleCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
#Calculate the area
area=(sp*(sp-s1)*(sp-s2)*(sp-s3))**0.5

print('The area of the triangle is %0.4f'%area)
#Calculate the perimeter
perimeter = s1 + s2 + s3

print('The area of the triangle is %0.4f'%area)

print('The perimeter of the triangle is %0.4f'%perimeter)