66A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""
77
88from 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):
44125NOT: "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 )
0 commit comments