6
6
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""
7
7
8
8
from Basic_Maths .Lib .lib import *
9
+ from Basic_Maths .Lib .file import *
9
10
10
- def Addition (x ,y ,ResultDialog ):
11
+ def Addition (x ,y ,ResultDialog , save_cfg , file_name , save_err_msg ):
11
12
print ("{0} {1} + {2} = {3}" . format (ResultDialog ,x ,y ,x + y ))
12
13
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 ):
14
23
print ("{0} {1} - {2} = {3}" . format (ResultDialog ,x ,y ,x - y ))
15
24
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 ):
17
34
print ("{0} {1} * {2} = {3}" . format (ResultDialog ,x ,y ,x * y ))
18
35
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 ):
20
45
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 :
23
48
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 )
24
57
25
- def Percentage (x ,y ,ResultDialog ):
58
+ def Percentage (x ,y ,ResultDialog , save_cfg , file_name , save_err_msg ):
26
59
print ("{0} ({1} * {2})/100 = {3}" . format (ResultDialog ,x ,y ,(x * y )/ 100 ))
27
60
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 ):
29
70
print ("{0} {1} % {2} = {3}" . format (ResultDialog ,x ,y ,x % y ))
30
71
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 ):
32
81
print ("{0} {1} // {2} = {3}" . format (ResultDialog ,x ,y ,x // y ))
33
82
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 ):
35
92
print ("{0} {1} ** {2} = {3}" . format (ResultDialog ,x ,y ,x ** y ))
36
93
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 ):
38
103
print ("{0} {1} / (1/{2}) = {3}" . format (ResultDialog ,x ,y ,x ** (1 / y )))
39
104
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 ):
41
114
print ("{0} {1} ** (1/2) = {2}" . format (ResultDialog ,x ,x ** (1 / 2 )))
42
115
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
+
43
124
""" TR (Turkish / Türkçe):
44
125
NOT: "Basic_Maths" kütüphanesini kullanan geliştiriciler programlarındaki ihtiyaçlara göre "Basic_Maths" fonksiyonlarını değiştirebilirler.
45
126
Ö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
64
145
number_one = input (nod )
65
146
number_two = input (ntd )
66
147
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 = "" )
68
149
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 = "" )
70
151
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 = "" )
72
153
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 = "" )
74
155
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 = "" )
76
157
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 = "" )
78
159
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 = "" )
80
161
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 = "" )
82
163
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 = "" )
84
165
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 = "" )
86
167
else :
87
168
error_msg (errdg )
0 commit comments