Skip to content

Commit 16c72d5

Browse files
Update Basic_Maths
1 parent 6d4d0c0 commit 16c72d5

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

Basic_Maths.py

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,62 @@
99

1010
PYTHON_LIB_NAME="Basic_Maths"
1111
PYTHON_LIB_LICENCE="GPL2"
12-
PYTHON_LIB_VER="2.2"
12+
PYTHON_LIB_VER="2.3"
1313
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
1414

1515
# Math functions
1616

17+
select_func = str()
18+
"""
19+
Example:
20+
21+
input_select = str(input('Which process?'))
22+
select_func = input_select
23+
1724
def addition(x,y,ResultDialog):
18-
x=x
19-
y=y
2025
result=x+y
21-
print("{0} {1} + {2} = {3}". format(ResultDialog,x,y,result))
26+
print("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
27+
28+
"""
29+
30+
def addition(x,y,ResultDialog):
31+
result=x+y
32+
print("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
33+
2234
def Extraction(x,y,ResultDialog):
23-
x=x
24-
y=y
2535
result=x-y
26-
print("{0} {1} - {2} = {3}". format(ResultDialog,x,y,result))
36+
print("{0} {1} {2} - {3} = {4}". format(select_func,ResultDialog,x,y,result))
37+
2738
def Multiplication(x,y,ResultDialog):
28-
x=x
29-
y=y
3039
result=x*y
31-
print("{0} {1} * {2} = {3}". format(ResultDialog,x,y,result))
40+
print("{0} {1} {2} * {3} = {4}". format(select_func,ResultDialog,x,y,result))
41+
3242
def Division(x,y,ResultDialog):
33-
x=x
34-
y=y
3543
if y=0:
3644
print("The second number cannot be zero in division!")
3745
if y>0:
3846
result=x/y
39-
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,result))
47+
print("{0} {1} {2} / {3} = {4}". format(select_func,ResultDialog,x,y,result))
48+
4049
def Percentage(x,y,ResultDialog):
41-
x=x
42-
y=y
4350
result=x%y
44-
print("{0} {1} % {2} = {3}". format(ResultDialog,x,y,result))
51+
print("{0} {1} {2} % {3} = {4}". format(select_func,ResultDialog,x,y,result))
52+
4553
def FullDivision(x,y,ResultDialog):
46-
x=x
47-
y=y
4854
result=x//y
49-
print("{0} {1} // {2} = {3}". format(ResultDialog,x,y,result))
55+
print("{0} {1} {2} // {3} = {4}". format(select_func,ResultDialog,x,y,result))
56+
5057
def TakingExponents(x,y,ResultDialog):
51-
x=x
52-
y=y
5358
result=x ** y
54-
print("{0} {1} ** {2} = {3}". format(ResultDialog,x,y,result))
59+
print("{0} {1} {2} ** {3} = {4}". format(select_func,ResultDialog,x,y,result))
60+
5561
def TakingRoots(x,y,ResultDialog):
56-
x=x
57-
y=y
5862
result=x ** (1/y)
59-
print("{0} {1} / (1/y) = {2}". format(ResultDialog,x,result))
63+
print("{0} {1} {2} / (1/y) = {3}". format(select_func,ResultDialog,x,result))
64+
6065
def SqaureRoot(x,ResultDialog):
61-
x=x
6266
result=x ** (1/2)
63-
print("{0} {1} ** (1/2) = {2}". format(ResultDialog,x,result))
67+
print("{0} {1} {2} ** (1/2) = {3}". format(select_func,ResultDialog,x,result))
6468

6569

6670
# Library functions

Example/basic_maths_calc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/usr/bin/python3
2-
# Basic_Maths ile yapılmış bir calcutator programıdır. (Basic_Maths) kullanımına örnek olması amaçlı yazılmıştır.
3-
# It is a calculator program made with Basic_Maths. It was written to serve as an example of (Basic_Maths) usage.
2+
""" Basic_Maths ile yapılmış bir örnek programdır. (Basic_Maths) kullanımına örnek olması amaçlı yazılmıştır.
3+
"basic_maths_calc.py" adlı dosyanın paylaşılmasına (internette blog/gönderi vs.) gönderilerinde paylaşılmasına @LinuxUsersLinuxMint tarafından izin verilmiştir.
4+
It is a example program made with Basic_Maths. It was written to serve as an example of (Basic_Maths) usage.
5+
Sharing of the file named "basic_maths_calc.py" in posts (blog/post etc. on the internet) has been given permission by @LinuxUsersLinuxMint. """
46

57
from Basic_Maths import *
68
number1=int(input('N1: '))
79
number2=int(input('N2: '))
810
select=str(input('Select (Add, Ext, Mul, Div, Per, FullDiv, TakeEx): '))
911

12+
input_select = str(input('Which process?'))
13+
select_func = input_select
1014
resultdialog = str("Result:")
1115

1216
if select=="Add":

0 commit comments

Comments
 (0)