Skip to content

Commit

Permalink
Update Basic_Maths.
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxUsersLinuxMint committed Feb 20, 2025
1 parent b7a09e1 commit 11a459e
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 26 deletions.
125 changes: 103 additions & 22 deletions Basic_Maths/Basic_Maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,121 @@
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""

from Basic_Maths.Lib.lib import *
from Basic_Maths.Lib.file import *

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

def Extraction(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} + {2} = {3}\n". format(ResultDialog,x,y,x+y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def Multiplication(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x-y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def Division(x,y,ResultDialog,check_zero_control_msg):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} * {2} = {3}\n". format(ResultDialog,x,y,x*y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

def Division(x,y,ResultDialog,check_zero_msg,save_cfg,file_name,save_err_msg):
if x==0 or y==0:
print(check_zero_control_msg)
if y>0 and x>0:
print(check_zero_msg)
else:
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,x/y))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} / {2} = {3}\n". format(ResultDialog,x,y,x/y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def Mod(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} ({1} * {2})/100 = {3}\n". format(ResultDialog,x,y,(x*y)/100))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def FullDivision(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} % {2} = {3}\n". format(ResultDialog,x,y,x%y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def TakingExponents(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} // {2} = {3}\n". format(ResultDialog,x,y,x//y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def TakingRoots(x,y,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} ** {2} = {3}\n". format(ResultDialog,x,y,x**y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

def SqaureRoot(x,ResultDialog):
if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x**(1/y)))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

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

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} ** (1/2) {2} = {3}\n". format(ResultDialog,x,x**(1/2)))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)

""" TR (Turkish / Türkçe):
NOT: "Basic_Maths" kütüphanesini kullanan geliştiriciler programlarındaki ihtiyaçlara göre "Basic_Maths" fonksiyonlarını değiştirebilirler.
Ö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.
Expand All @@ -64,24 +145,24 @@ def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_d
number_one=input(nod)
number_two=input(ntd)
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:
Addition(number_one,number_two,resdialog)
Addition(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
Extraction(number_one,number_two,resdialog)
Extraction(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
Multiplication(number_one,number_two,resdialog)
Multiplication(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
Division(number_one,number_two,resdialog,divisionzerocheckdialog)
Division(number_one,number_two,resdialog,divisionzerocheckdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
Percentage(number_one,number_two,resdialog)
Percentage(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
FullDivision(number_one,number_two,resdialog)
FullDivision(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
TakingExponents(number_one,number_two,resdialog)
TakingExponents(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
TakingRoots(number_one,number_two,resdialog)
TakingRoots(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
SqaureRoot(number_one,resdialog)
SqaureRoot(number_one,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
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:
Mod(number_one,number_two,resdialog)
Mod(number_one,number_two,resdialog,save_cfg=OFF,file_name="",save_err_msg="")
else:
error_msg(errdg)
9 changes: 9 additions & 0 deletions Basic_Maths/Lib/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/python3
""" Copyright© 2023-2025 LinuxUsersLinuxMint
Basic_Maths Tüm Hakları GPL(Genel Kamu Lisansı) altında korunmaktadır.
Basic_Maths All Rights Reserved under the GPL(General Public License).
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
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""

ON=0
OFF=0
6 changes: 3 additions & 3 deletions Basic_Maths/lib_ver_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
PYTHON_LIB_NAME="Basic_Maths"
PYTHON_LIB_LICENCE="GPL2"
PYTHON_LIB_IMPLEMENTED_CONTRACTS="LinuxUsersLinuxMint Privacy and Security Agreement , LinuxUsersLinuxMint Web (Site) Agreement"
PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE="https://linuxuserslinuxmint.github.io/Contracts/privacyandsecutryagreement/en/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/en/linuxuserslinuxmintwebsiteagreement.html"
PYTHON_LIB_VER="5.5"
PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE="https://linuxuserslinuxmint.github.io/Contracts/privacyandsecutryagreement/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/linuxuserslinuxmintwebsiteagreement.html"
PYTHON_LIB_VER="5.7"
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
PYTHON_LIB_RELEASE_DATE="9/30/2023, Time: XX:XX"
PYTHON_LIB_LAST_UPDATE_DATE="2/10/2025, Time: 20:53 / 8:53 PM"
PYTHON_LIB_LAST_UPDATE_DATE="2/20/2025, Time: 18:48 / 6:48 PM"
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"
6 changes: 5 additions & 1 deletion basic_maths_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
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","","")
error_msg("error msg [TEST_FUNCTION]")

exit_program_time(10)
exit_program_time(10)

Addition(10,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
Extraction(20,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
Multiplication(30,5,"RESULT:",save_cfg=ON,file_name="test.txt",save_err_msg="Error_msg")
3 changes: 3 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RESULT: 10 + 5 = 15
RESULT: 20 - 5 = 15
RESULT: 30 * 5 = 150

0 comments on commit 11a459e

Please sign in to comment.