Skip to content

Commit 85467c5

Browse files
Update Basic_Maths.
1 parent d8442d5 commit 85467c5

File tree

5 files changed

+49
-73
lines changed

5 files changed

+49
-73
lines changed

Basic_Maths/Basic_Maths.py

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,31 @@ def Addition(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
1212
print("{0} {1} + {2} = {3}". format(ResultDialog,x,y,x+y))
1313

1414
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))
15+
file(file_name=file_name,file_mode="a",file_write="{0} {1} + {2} = {3}\n". format(ResultDialog,x,y,x+y))
1716
elif save_cfg == OFF:
1817
pass
1918
else:
20-
error_msg(save_err_msg)
19+
error_msg(save_err_msg,"","")
2120

2221
def Extraction(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
2322
print("{0} {1} - {2} = {3}". format(ResultDialog,x,y,x-y))
2423

2524
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))
25+
file(file_name=file_name,file_mode="a",file_write="{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x-y))
2826
elif save_cfg == OFF:
2927
pass
3028
else:
31-
error_msg(save_err_msg)
29+
error_msg(save_err_msg,"","")
3230

3331
def Multiplication(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
3432
print("{0} {1} * {2} = {3}". format(ResultDialog,x,y,x*y))
3533

3634
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))
35+
file(file_name=file_name,file_mode="a",file_write="{0} {1} * {2} = {3}\n". format(ResultDialog,x,y,x*y))
3936
elif save_cfg == OFF:
4037
pass
4138
else:
42-
error_msg(save_err_msg)
39+
error_msg(save_err_msg,"","")
4340

4441
def Division(x,y,ResultDialog,check_zero_msg,save_cfg,file_name,save_err_msg):
4542
if x==0 or y==0:
@@ -48,78 +45,71 @@ def Division(x,y,ResultDialog,check_zero_msg,save_cfg,file_name,save_err_msg):
4845
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,x/y))
4946

5047
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))
48+
file(file_name=file_name,file_mode="a",file_write="{0} {1} / {2} = {3}\n". format(ResultDialog,x,y,x/y))
5349
elif save_cfg == OFF:
5450
pass
5551
else:
56-
error_msg(save_err_msg)
52+
error_msg(save_err_msg,"","")
5753

5854
def Percentage(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
5955
print("{0} ({1} * {2})/100 = {3}". format(ResultDialog,x,y,(x*y)/100))
6056

6157
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))
58+
file(file_name=file_name,file_mode="a",file_write="{0} ({1} * {2})/100 = {3}\n". format(ResultDialog,x,y,(x*y)/100))
6459
elif save_cfg == OFF:
6560
pass
6661
else:
67-
error_msg(save_err_msg)
62+
error_msg(save_err_msg,"","")
6863

6964
def Mod(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
7065
print("{0} {1} % {2} = {3}". format(ResultDialog,x,y,x%y))
7166

7267
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))
68+
file(file_name=file_name,file_mode="a",file_write="{0} {1} % {2} = {3}\n". format(ResultDialog,x,y,x%y))
7569
elif save_cfg == OFF:
7670
pass
7771
else:
78-
error_msg(save_err_msg)
72+
error_msg(save_err_msg,"","")
7973

8074
def FullDivision(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
8175
print("{0} {1} // {2} = {3}". format(ResultDialog,x,y,x//y))
8276

8377
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))
78+
file(file_name=file_name,file_mode="a",file_write="{0} {1} // {2} = {3}\n". format(ResultDialog,x,y,x//y))
8679
elif save_cfg == OFF:
8780
pass
8881
else:
89-
error_msg(save_err_msg)
82+
error_msg(save_err_msg,"","")
9083

9184
def TakingExponents(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
9285
print("{0} {1} ** {2} = {3}". format(ResultDialog,x,y,x**y))
9386

9487
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))
88+
file(file_name=file_name,file_mode="a",file_write="{0} {1} ** {2} = {3}\n". format(ResultDialog,x,y,x**y))
9789
elif save_cfg == OFF:
9890
pass
9991
else:
100-
error_msg(save_err_msg)
92+
error_msg(save_err_msg,"","")
10193

10294
def TakingRoots(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
10395
print("{0} {1} / (1/{2}) = {3}". format(ResultDialog,x,y,x**(1/y)))
10496

10597
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)))
98+
file(file_name=file_name,file_mode="a",file_write="{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x**(1/y)))
10899
elif save_cfg == OFF:
109100
pass
110101
else:
111-
error_msg(save_err_msg)
102+
error_msg(save_err_msg,"","")
112103

113104
def SqaureRoot(x,ResultDialog,save_cfg,file_name,save_err_msg):
114105
print("{0} {1} ** (1/2) = {2}". format(ResultDialog,x,x**(1/2)))
115106

116107
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)))
108+
file(file_name=file_name,file_mode="a",file_write="{0} {1} ** (1/2) {2} = {3}\n". format(ResultDialog,x,x**(1/2)))
119109
elif save_cfg == OFF:
120110
pass
121111
else:
122-
error_msg(save_err_msg)
112+
error_msg(save_err_msg,"","")
123113

124114
""" TR (Turkish / Türkçe):
125115
NOT: "Basic_Maths" kütüphanesini kullanan geliştiriciler programlarındaki ihtiyaçlara göre "Basic_Maths" fonksiyonlarını değiştirebilirler.
@@ -165,4 +155,4 @@ def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_d
165155
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:
166156
Mod(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
167157
else:
168-
error_msg(errdg)
158+
error_msg(errdg,"","")

Basic_Maths/lib_ver_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
PYTHON_LIB_LICENCE="GPL2"
1010
PYTHON_LIB_IMPLEMENTED_CONTRACTS="LinuxUsersLinuxMint Privacy and Security Agreement , LinuxUsersLinuxMint Web (Site) Agreement"
1111
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"
12+
PYTHON_LIB_VER="6.0"
1313
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
1414
PYTHON_LIB_RELEASE_DATE="9/30/2023, Time: 14:49 / 2:49 PM"
15-
PYTHON_LIB_LAST_UPDATE_DATE="2/20/2025, Time: 18:48 / 6:48 PM"
15+
PYTHON_LIB_LAST_UPDATE_DATE="2/21/2025, Time: 23:17 / 11:17 PM"
1616
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
1717
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"

PyAppDevKit/LibFunc/pyappdevkit.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,28 @@ def time(number):
1111
for _ in range(100000000):
1212
pass
1313

14-
def error_msg(error_dialog):
15-
print(error_dialog)
14+
def file(file_name,file_mode,file_write):
15+
create_file = open(file_name, file_mode)
16+
if file_mode == "w" or file_mode == "a":
17+
create_file.write("{0}\n". format(file_write))
18+
elif file_mode == "r":
19+
print(create_file.read())
20+
21+
def error_msg(error_dialog,error_code,support_link):
22+
print(error_dialog,error_code,support_link)
1623

1724
def exit_program_dialog_time(exit_dialog_msg,userTime):
1825
print(exit_dialog_msg)
19-
userTime = int(userTime)
2026
time(userTime)
2127
exit()
2228

2329
def exit_program_time(userTime):
24-
userTime = int(userTime)
2530
time(userTime)
2631
exit()
2732

2833
def exit_program_dialog(exit_dialog_msg):
2934
print(exit_dialog_msg)
35+
exit()
3036

3137
""" Example Dialog (ExitSelectDialog): "Select the method to exit the program (0: Dialogue and Time entry, 1: Time entry only, 2: Dialogue entry only, 3: Normal exit (old style)): "
3238
Example Dialog (userTimeDialog): "After how many seconds should the program be closed?: "
@@ -35,12 +41,11 @@ def exit_program_dialog(exit_dialog_msg):
3541

3642
def all_exit(ExitSelectDialog,userTimeDialog,exitDialog,errormsgDialog):
3743
exit_select = int(input(ExitSelectDialog))
38-
exit_select = int(exit_select)
3944
if exit_select == 0:
40-
userTime = input(userTimeDialog)
45+
userTime = int(input(userTimeDialog))
4146
exit_program_dialog_time(exitDialog, userTime)
4247
elif exit_select == 1:
43-
userTime = input(userTimeDialog)
48+
userTime = int(input(userTimeDialog))
4449
exit_program_time(userTime)
4550
elif exit_select == 2:
4651
exit_program_dialog(exitDialog)
@@ -49,19 +54,7 @@ def all_exit(ExitSelectDialog,userTimeDialog,exitDialog,errormsgDialog):
4954
else:
5055
print(errormsgDialog)
5156

52-
def program_info(dialog_one,dialog_one_t,dialog_two,dialog_two_t,dialog_three,dialog_three_t,dialog_four,dialog_four_t,dialog_five,dialog_five_t,dialog_six,dialog_six_t,dialog_seven,dialog_seven_t,dialog_eigth,dialog_eight_t,dialog_nine,dialog_nine_t,dialog_ten,dialog_ten_t):
53-
print("{0} {1}". format(dialog_one,dialog_one_t))
54-
print("{0} {1}". format(dialog_two,dialog_two_t))
55-
print("{0} {1}". format(dialog_three,dialog_three_t))
56-
print("{0} {1}". format(dialog_four,dialog_four_t))
57-
print("{0} {1}". format(dialog_five,dialog_five_t))
58-
print("{0} {1}". format(dialog_six,dialog_six_t))
59-
print("{0} {1}". format(dialog_seven,dialog_seven_t))
60-
print("{0} {1}". format(dialog_eigth,dialog_eight_t))
61-
print("{0} {1}". format(dialog_nine,dialog_nine_t))
62-
print("{0} {1}". format(dialog_ten,dialog_ten_t))
63-
64-
def library_info(dialog_one,dialog_one_t,dialog_two,dialog_two_t,dialog_three,dialog_three_t,dialog_four,dialog_four_t,dialog_five,dialog_five_t,dialog_six,dialog_six_t,dialog_seven,dialog_seven_t,dialog_eigth,dialog_eight_t,dialog_nine,dialog_nine_t,dialog_ten,dialog_ten_t):
57+
def app_info(dialog_one,dialog_one_t,dialog_two,dialog_two_t,dialog_three,dialog_three_t,dialog_four,dialog_four_t,dialog_five,dialog_five_t,dialog_six,dialog_six_t,dialog_seven,dialog_seven_t,dialog_eigth,dialog_eight_t,dialog_nine,dialog_nine_t,dialog_ten,dialog_ten_t):
6558
print("{0} {1}". format(dialog_one,dialog_one_t))
6659
print("{0} {1}". format(dialog_two,dialog_two_t))
6760
print("{0} {1}". format(dialog_three,dialog_three_t))
@@ -79,8 +72,8 @@ def program_welcome_msg(welcome_msg,cfg,cfg_,appname,libname,websitelink):
7972
print(websitelink)
8073
elif cfg == 0:
8174
if cfg_ == "lib":
82-
library_info("Library Name: ",libname,"","","","","","","","","","","","","","","","","","")
75+
app_info("Library Name: ",libname,"","","","","","","","","","","","","","","","","","")
8376
elif cfg_ == "app":
84-
program_info("Program Name: ",appname,"","","","","","","","","","","","","","","","","","")
77+
app_info("Program Name: ",appname,"","","","","","","","","","","","","","","","","","")
8578
else:
86-
error_msg("Invalid definition!")
79+
error_msg("Invalid definition!","","")

PyAppDevKit/LibFunc/pyappdevkit_info.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,18 @@
55
Bu Yazılımın Bir Kopyası GİTHUB da yayınlanmaktadır Görüntülemek için: https://github.com/LinuxUsersLinuxMint/PyAppDevKit
66
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/PyAppDevKit"""
77

8+
from LibFunc.pyappdevkit import *
9+
810
PYTHON_LIB_NAME="PyAppDevKit"
911
PYTHON_LIB_LICENCE="GPL2"
1012
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="1.6"
13+
PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE="https://linuxuserslinuxmint.github.io/Contracts/privacyandsecutryagreement/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/linuxuserslinuxmintwebsiteagreement.html"
14+
PYTHON_LIB_VER="1.8"
1315
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
1416
PYTHON_LIB_RELEASE_DATE="6/9/2024, Time: 17:54"
15-
PYTHON_LIB_LAST_UPDATE_DATE="1/1/2025, Time: 19:00 / 7:00 PM"
17+
PYTHON_LIB_LAST_UPDATE_DATE="2/21/2025, Time: 22:46 / 10:46 PM"
1618
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
1719
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"
1820

1921
def LibAbout():
20-
print("Python Library Name:", format(PYTHON_LIB_NAME))
21-
print("Python Library Version:", format(PYTHON_LIB_VER))
22-
print("Python Library Support OS:", format(PYTHON_LIB_SUPPORT_PLATFORM))
23-
print("Python Library Licence Name:", format(PYTHON_LIB_LICENCE))
24-
print("Python Library Implemented Contracts:", format(PYTHON_LIB_IMPLEMENTED_CONTRACTS))
25-
print("Python Library Implemented Contracts Web Site:", format(PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE))
26-
print("Python Library Author Name:", format(PYTHON_LIB_AUTHOR))
27-
print("Python Library Author Web Site:", format(PYTHON_LIB_AUTHOR_WEB_SITE))
28-
print("Python Library Release Date:", format(PYTHON_LIB_RELEASE_DATE))
29-
print("Python Library Last Update Date:", format(PYTHON_LIB_LAST_UPDATE_DATE))
22+
app_info("Python Library Name:",PYTHON_LIB_NAME,"Python Library Version:",PYTHON_LIB_VER,"Python Library Support OS:",PYTHON_LIB_SUPPORT_PLATFORM,"Python Library Licence Name:",PYTHON_LIB_LICENCE,"Python Library Implemented Contracts:",PYTHON_LIB_IMPLEMENTED_CONTRACTS,"Python Library Implemented Contracts Web Site:",PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE,"Python Library Author Name:",PYTHON_LIB_AUTHOR,"Python Library Author Web Site:",PYTHON_LIB_AUTHOR_WEB_SITE,"Python Library Release Date:",PYTHON_LIB_RELEASE_DATE,"Python Library Last Update Date:",PYTHON_LIB_LAST_UPDATE_DATE)

basic_maths_calc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
from Basic_Maths.Basic_Maths import *
88

9-
LibAbout()
10-
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","","")
11-
error_msg("error msg [TEST_FUNCTION]")
9+
#LibAbout()
10+
#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","","")
11+
#error_msg("error msg [TEST_FUNCTION]")
1212

13-
exit_program_time(10)
13+
#exit_program_time(10)
1414

1515
Addition(10,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
1616
Extraction(20,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")

0 commit comments

Comments
 (0)