|
9 | 9 |
|
10 | 10 | PYTHON_LIB_NAME="Basic_Maths" |
11 | 11 | PYTHON_LIB_LICENCE="GPL2" |
12 | | -PYTHON_LIB_VER="2.2" |
| 12 | +PYTHON_LIB_VER="2.3" |
13 | 13 | PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint" |
14 | 14 |
|
15 | 15 | # Math functions |
16 | 16 |
|
| 17 | +select_func = str() |
| 18 | +""" |
| 19 | +Example: |
| 20 | +
|
| 21 | +input_select = str(input('Which process?')) |
| 22 | +select_func = input_select |
| 23 | +
|
17 | 24 | def addition(x,y,ResultDialog): |
18 | | - x=x |
19 | | - y=y |
20 | 25 | 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 | + |
22 | 34 | def Extraction(x,y,ResultDialog): |
23 | | - x=x |
24 | | - y=y |
25 | 35 | 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 | + |
27 | 38 | def Multiplication(x,y,ResultDialog): |
28 | | - x=x |
29 | | - y=y |
30 | 39 | 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 | + |
32 | 42 | def Division(x,y,ResultDialog): |
33 | | - x=x |
34 | | - y=y |
35 | 43 | if y=0: |
36 | 44 | print("The second number cannot be zero in division!") |
37 | 45 | if y>0: |
38 | 46 | 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 | + |
40 | 49 | def Percentage(x,y,ResultDialog): |
41 | | - x=x |
42 | | - y=y |
43 | 50 | 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 | + |
45 | 53 | def FullDivision(x,y,ResultDialog): |
46 | | - x=x |
47 | | - y=y |
48 | 54 | 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 | + |
50 | 57 | def TakingExponents(x,y,ResultDialog): |
51 | | - x=x |
52 | | - y=y |
53 | 58 | 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 | + |
55 | 61 | def TakingRoots(x,y,ResultDialog): |
56 | | - x=x |
57 | | - y=y |
58 | 62 | 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 | + |
60 | 65 | def SqaureRoot(x,ResultDialog): |
61 | | - x=x |
62 | 66 | 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)) |
64 | 68 |
|
65 | 69 |
|
66 | 70 | # Library functions |
|
0 commit comments