Skip to content

Commit 11a459e

Browse files
Update Basic_Maths.
1 parent b7a09e1 commit 11a459e

File tree

5 files changed

+123
-26
lines changed

5 files changed

+123
-26
lines changed

Basic_Maths/Basic_Maths.py

+103-22
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,121 @@
66
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""
77

88
from Basic_Maths.Lib.lib import *
9+
from Basic_Maths.Lib.file import *
910

10-
def Addition(x,y,ResultDialog):
11+
def Addition(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
1112
print("{0} {1} + {2} = {3}". format(ResultDialog,x,y,x+y))
1213

13-
def Extraction(x,y,ResultDialog):
14+
if save_cfg == ON:
15+
create_file = open(file_name, "a")
16+
create_file.write("{0} {1} + {2} = {3}\n". format(ResultDialog,x,y,x+y))
17+
elif save_cfg == OFF:
18+
pass
19+
else:
20+
error_msg(save_err_msg)
21+
22+
def Extraction(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
1423
print("{0} {1} - {2} = {3}". format(ResultDialog,x,y,x-y))
1524

16-
def Multiplication(x,y,ResultDialog):
25+
if save_cfg == ON:
26+
create_file = open(file_name, "a")
27+
create_file.write("{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x-y))
28+
elif save_cfg == OFF:
29+
pass
30+
else:
31+
error_msg(save_err_msg)
32+
33+
def Multiplication(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
1734
print("{0} {1} * {2} = {3}". format(ResultDialog,x,y,x*y))
1835

19-
def Division(x,y,ResultDialog,check_zero_control_msg):
36+
if save_cfg == ON:
37+
create_file = open(file_name, "a")
38+
create_file.write("{0} {1} * {2} = {3}\n". format(ResultDialog,x,y,x*y))
39+
elif save_cfg == OFF:
40+
pass
41+
else:
42+
error_msg(save_err_msg)
43+
44+
def Division(x,y,ResultDialog,check_zero_msg,save_cfg,file_name,save_err_msg):
2045
if x==0 or y==0:
21-
print(check_zero_control_msg)
22-
if y>0 and x>0:
46+
print(check_zero_msg)
47+
else:
2348
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,x/y))
49+
50+
if save_cfg == ON:
51+
create_file = open(file_name, "a")
52+
create_file.write("{0} {1} / {2} = {3}\n". format(ResultDialog,x,y,x/y))
53+
elif save_cfg == OFF:
54+
pass
55+
else:
56+
error_msg(save_err_msg)
2457

25-
def Percentage(x,y,ResultDialog):
58+
def Percentage(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
2659
print("{0} ({1} * {2})/100 = {3}". format(ResultDialog,x,y,(x*y)/100))
2760

28-
def Mod(x,y,ResultDialog):
61+
if save_cfg == ON:
62+
create_file = open(file_name, "a")
63+
create_file.write("{0} ({1} * {2})/100 = {3}\n". format(ResultDialog,x,y,(x*y)/100))
64+
elif save_cfg == OFF:
65+
pass
66+
else:
67+
error_msg(save_err_msg)
68+
69+
def Mod(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
2970
print("{0} {1} % {2} = {3}". format(ResultDialog,x,y,x%y))
3071

31-
def FullDivision(x,y,ResultDialog):
72+
if save_cfg == ON:
73+
create_file = open(file_name, "a")
74+
create_file.write("{0} {1} % {2} = {3}\n". format(ResultDialog,x,y,x%y))
75+
elif save_cfg == OFF:
76+
pass
77+
else:
78+
error_msg(save_err_msg)
79+
80+
def FullDivision(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
3281
print("{0} {1} // {2} = {3}". format(ResultDialog,x,y,x//y))
3382

34-
def TakingExponents(x,y,ResultDialog):
83+
if save_cfg == ON:
84+
create_file = open(file_name, "a")
85+
create_file.write("{0} {1} // {2} = {3}\n". format(ResultDialog,x,y,x//y))
86+
elif save_cfg == OFF:
87+
pass
88+
else:
89+
error_msg(save_err_msg)
90+
91+
def TakingExponents(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
3592
print("{0} {1} ** {2} = {3}". format(ResultDialog,x,y,x**y))
3693

37-
def TakingRoots(x,y,ResultDialog):
94+
if save_cfg == ON:
95+
create_file = open(file_name, "a")
96+
create_file.write("{0} {1} ** {2} = {3}\n". format(ResultDialog,x,y,x**y))
97+
elif save_cfg == OFF:
98+
pass
99+
else:
100+
error_msg(save_err_msg)
101+
102+
def TakingRoots(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
38103
print("{0} {1} / (1/{2}) = {3}". format(ResultDialog,x,y,x**(1/y)))
39104

40-
def SqaureRoot(x,ResultDialog):
105+
if save_cfg == ON:
106+
create_file = open(file_name, "a")
107+
create_file.write("{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x**(1/y)))
108+
elif save_cfg == OFF:
109+
pass
110+
else:
111+
error_msg(save_err_msg)
112+
113+
def SqaureRoot(x,ResultDialog,save_cfg,file_name,save_err_msg):
41114
print("{0} {1} ** (1/2) = {2}". format(ResultDialog,x,x**(1/2)))
42115

116+
if save_cfg == ON:
117+
create_file = open(file_name, "a")
118+
create_file.write("{0} {1} ** (1/2) {2} = {3}\n". format(ResultDialog,x,x**(1/2)))
119+
elif save_cfg == OFF:
120+
pass
121+
else:
122+
error_msg(save_err_msg)
123+
43124
""" TR (Turkish / Türkçe):
44125
NOT: "Basic_Maths" kütüphanesini kullanan geliştiriciler programlarındaki ihtiyaçlara göre "Basic_Maths" fonksiyonlarını değiştirebilirler.
45126
ÖNERİ: Eğer istekleriniz veya ihtiyaçlarınız farklıysa "all_math_operations()" fonksiyonunu kullanmadan önce ihtiyaçlarınız doğrultusunda değiştirmeniz önerilir.
@@ -64,24 +145,24 @@ def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_d
64145
number_one=input(nod)
65146
number_two=input(ntd)
66147
if select_func == addition_options_one or select_func == addition_options_two or select_func == addition_options_three or select_func == addition_options_four or select_func == addition_options_five:
67-
Addition(number_one,number_two,resdialog)
148+
Addition(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
68149
elif select_func == extraction_options_one or select_func == extraction_options_two or select_func == extraction_options_three or select_func == extraction_options_four or select_func == extraction_options_five:
69-
Extraction(number_one,number_two,resdialog)
150+
Extraction(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
70151
elif select_func == multiplication_options_one or select_func == multiplication_options_two or select_func == multiplication_options_three or select_func == multiplication_options_four or select_func == multiplication_options_five:
71-
Multiplication(number_one,number_two,resdialog)
152+
Multiplication(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
72153
elif select_func == division_options_one or select_func == division_options_two or select_func == division_options_three or select_func == division_options_four or select_func == division_options_five:
73-
Division(number_one,number_two,resdialog,divisionzerocheckdialog)
154+
Division(number_one,number_two,resdialog,divisionzerocheckdialog,save_cfg=OFF,file_name="",save_err_msg="")
74155
elif select_func == percentage_options_one or select_func == percentage_options_two or select_func == percentage_options_three or select_func == percentage_options_four or select_func == percentage_options_five:
75-
Percentage(number_one,number_two,resdialog)
156+
Percentage(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
76157
elif select_func == fulldivision_options_one or select_func == fulldivision_options_two or select_func == fulldivision_options_three or select_func == fulldivision_options_four or select_func == fulldivision_options_five:
77-
FullDivision(number_one,number_two,resdialog)
158+
FullDivision(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
78159
elif select_func == takingexponents_options_one or select_func == takingexponents_options_two or select_func == takingexponents_options_three or select_func == takingexponents_options_four or select_func == takingexponents_options_five:
79-
TakingExponents(number_one,number_two,resdialog)
160+
TakingExponents(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
80161
elif select_func == takingroots_options_one or select_func == takingroots_options_two or select_func == takingroots_options_three or select_func == takingroots_options_four or select_func == takingroots_options_five:
81-
TakingRoots(number_one,number_two,resdialog)
162+
TakingRoots(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
82163
elif select_func == squareroot_options_one or select_func == squareroot_options_two or select_func == squareroot_options_three or select_func == squareroot_options_four or select_func == squareroot_options_five:
83-
SqaureRoot(number_one,resdialog)
164+
SqaureRoot(number_one,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
84165
elif select_func == mod_options_one or select_func == mod_options_two or select_func == mod_options_three or select_func == mod_options_four or select_func == mod_options_five:
85-
Mod(number_one,number_two,resdialog)
166+
Mod(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
86167
else:
87168
error_msg(errdg)

Basic_Maths/Lib/file.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/python3
2+
""" Copyright© 2023-2025 LinuxUsersLinuxMint
3+
Basic_Maths Tüm Hakları GPL(Genel Kamu Lisansı) altında korunmaktadır.
4+
Basic_Maths All Rights Reserved under the GPL(General Public License).
5+
Bu Yazılımın Bir Kopyası GİTHUB da yayınlanmaktadır Görüntülemek için: https://github.com/LinuxUsersLinuxMint/Basic_Maths
6+
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""
7+
8+
ON=0
9+
OFF=0

Basic_Maths/lib_ver_info.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
PYTHON_LIB_NAME="Basic_Maths"
99
PYTHON_LIB_LICENCE="GPL2"
1010
PYTHON_LIB_IMPLEMENTED_CONTRACTS="LinuxUsersLinuxMint Privacy and Security Agreement , LinuxUsersLinuxMint Web (Site) Agreement"
11-
PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE="https://linuxuserslinuxmint.github.io/Contracts/privacyandsecutryagreement/en/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/en/linuxuserslinuxmintwebsiteagreement.html"
12-
PYTHON_LIB_VER="5.5"
11+
PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE="https://linuxuserslinuxmint.github.io/Contracts/privacyandsecutryagreement/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/linuxuserslinuxmintwebsiteagreement.html"
12+
PYTHON_LIB_VER="5.7"
1313
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
1414
PYTHON_LIB_RELEASE_DATE="9/30/2023, Time: XX:XX"
15-
PYTHON_LIB_LAST_UPDATE_DATE="2/10/2025, Time: 20:53 / 8:53 PM"
15+
PYTHON_LIB_LAST_UPDATE_DATE="2/20/2025, Time: 18:48 / 6:48 PM"
1616
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
1717
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"

basic_maths_calc.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
all_math_operations("Select Operations: ","1. Addition","2. Extraction","3. Multiplication","4. Division","5. Percentage","6. FullDivision","7. TakingExponents","8. TakingRoots","9. SquareRoot","10. Mod","Select a transaction?: ","Enter the 1st number: ","Enter the 2nd number: ","Result:","Numbers cannot be zero in division!","Invalid Process!","1","add","addition","Addition","Toplama","2","ext","extraction","Extraction","Çıkarma","3","mul","multiplication","Multiplication","Çarpma","4","div","division","Division","Bölme","5","per","percentage","Percentage","Yüzdelik hesaplama","6","fulldiv","fulldivision","FullDivision","Tam bölüm","7","takingexp","takingexponents","TakingExponents","Üslü sayı alma","8","takingrt","takingroots","TakingRoots","Kök Alma","9","sqrt","squareroot","SquareRoot","Karekök","10","Mod","Modulus operation","","")
1111
error_msg("error msg [TEST_FUNCTION]")
1212

13-
exit_program_time(10)
13+
exit_program_time(10)
14+
15+
Addition(10,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
16+
Extraction(20,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
17+
Multiplication(30,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")

test.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RESULT: 10 + 5 = 15
2+
RESULT: 20 - 5 = 15
3+
RESULT: 30 * 5 = 150

0 commit comments

Comments
 (0)