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 21, 2025
1 parent d8442d5 commit 85467c5
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 73 deletions.
52 changes: 21 additions & 31 deletions Basic_Maths/Basic_Maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,31 @@ def Addition(x,y,ResultDialog,save_cfg,file_name,save_err_msg):
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))
file(file_name=file_name,file_mode="a",file_write="{0} {1} + {2} = {3}\n". format(ResultDialog,x,y,x+y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x-y))
file(file_name=file_name,file_mode="a",file_write="{0} {1} - {2} = {3}\n". format(ResultDialog,x,y,x-y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} * {2} = {3}\n". format(ResultDialog,x,y,x*y))
file(file_name=file_name,file_mode="a",file_write="{0} {1} * {2} = {3}\n". format(ResultDialog,x,y,x*y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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:
Expand All @@ -48,78 +45,71 @@ def Division(x,y,ResultDialog,check_zero_msg,save_cfg,file_name,save_err_msg):
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))
file(file_name=file_name,file_mode="a",file_write="{0} {1} / {2} = {3}\n". format(ResultDialog,x,y,x/y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
error_msg(save_err_msg,"","")

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))

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))
file(file_name=file_name,file_mode="a",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)
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))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} % {2} = {3}\n". format(ResultDialog,x,y,x%y))
file(file_name=file_name,file_mode="a",file_write="{0} {1} % {2} = {3}\n". format(ResultDialog,x,y,x%y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} // {2} = {3}\n". format(ResultDialog,x,y,x//y))
file(file_name=file_name,file_mode="a",file_write="{0} {1} // {2} = {3}\n". format(ResultDialog,x,y,x//y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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))

if save_cfg == ON:
create_file = open(file_name, "a")
create_file.write("{0} {1} ** {2} = {3}\n". format(ResultDialog,x,y,x**y))
file(file_name=file_name,file_mode="a",file_write="{0} {1} ** {2} = {3}\n". format(ResultDialog,x,y,x**y))
elif save_cfg == OFF:
pass
else:
error_msg(save_err_msg)
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)))

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)))
file(file_name=file_name,file_mode="a",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)
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)))
file(file_name=file_name,file_mode="a",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)
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.
Expand Down Expand Up @@ -165,4 +155,4 @@ def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_d
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,save_cfg=OFF,file_name="",save_err_msg="")
else:
error_msg(errdg)
error_msg(errdg,"","")
4 changes: 2 additions & 2 deletions Basic_Maths/lib_ver_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
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/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/linuxuserslinuxmintwebsiteagreement.html"
PYTHON_LIB_VER="5.7"
PYTHON_LIB_VER="6.0"
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
PYTHON_LIB_RELEASE_DATE="9/30/2023, Time: 14:49 / 2:49 PM"
PYTHON_LIB_LAST_UPDATE_DATE="2/20/2025, Time: 18:48 / 6:48 PM"
PYTHON_LIB_LAST_UPDATE_DATE="2/21/2025, Time: 23:17 / 11:17 PM"
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"
39 changes: 16 additions & 23 deletions PyAppDevKit/LibFunc/pyappdevkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,28 @@ def time(number):
for _ in range(100000000):
pass

def error_msg(error_dialog):
print(error_dialog)
def file(file_name,file_mode,file_write):
create_file = open(file_name, file_mode)
if file_mode == "w" or file_mode == "a":
create_file.write("{0}\n". format(file_write))
elif file_mode == "r":
print(create_file.read())

def error_msg(error_dialog,error_code,support_link):
print(error_dialog,error_code,support_link)

def exit_program_dialog_time(exit_dialog_msg,userTime):
print(exit_dialog_msg)
userTime = int(userTime)
time(userTime)
exit()

def exit_program_time(userTime):
userTime = int(userTime)
time(userTime)
exit()

def exit_program_dialog(exit_dialog_msg):
print(exit_dialog_msg)
exit()

""" 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)): "
Example Dialog (userTimeDialog): "After how many seconds should the program be closed?: "
Expand All @@ -35,12 +41,11 @@ def exit_program_dialog(exit_dialog_msg):

def all_exit(ExitSelectDialog,userTimeDialog,exitDialog,errormsgDialog):
exit_select = int(input(ExitSelectDialog))
exit_select = int(exit_select)
if exit_select == 0:
userTime = input(userTimeDialog)
userTime = int(input(userTimeDialog))
exit_program_dialog_time(exitDialog, userTime)
elif exit_select == 1:
userTime = input(userTimeDialog)
userTime = int(input(userTimeDialog))
exit_program_time(userTime)
elif exit_select == 2:
exit_program_dialog(exitDialog)
Expand All @@ -49,19 +54,7 @@ def all_exit(ExitSelectDialog,userTimeDialog,exitDialog,errormsgDialog):
else:
print(errormsgDialog)

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):
print("{0} {1}". format(dialog_one,dialog_one_t))
print("{0} {1}". format(dialog_two,dialog_two_t))
print("{0} {1}". format(dialog_three,dialog_three_t))
print("{0} {1}". format(dialog_four,dialog_four_t))
print("{0} {1}". format(dialog_five,dialog_five_t))
print("{0} {1}". format(dialog_six,dialog_six_t))
print("{0} {1}". format(dialog_seven,dialog_seven_t))
print("{0} {1}". format(dialog_eigth,dialog_eight_t))
print("{0} {1}". format(dialog_nine,dialog_nine_t))
print("{0} {1}". format(dialog_ten,dialog_ten_t))

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):
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):
print("{0} {1}". format(dialog_one,dialog_one_t))
print("{0} {1}". format(dialog_two,dialog_two_t))
print("{0} {1}". format(dialog_three,dialog_three_t))
Expand All @@ -79,8 +72,8 @@ def program_welcome_msg(welcome_msg,cfg,cfg_,appname,libname,websitelink):
print(websitelink)
elif cfg == 0:
if cfg_ == "lib":
library_info("Library Name: ",libname,"","","","","","","","","","","","","","","","","","")
app_info("Library Name: ",libname,"","","","","","","","","","","","","","","","","","")
elif cfg_ == "app":
program_info("Program Name: ",appname,"","","","","","","","","","","","","","","","","","")
app_info("Program Name: ",appname,"","","","","","","","","","","","","","","","","","")
else:
error_msg("Invalid definition!")
error_msg("Invalid definition!","","")
19 changes: 6 additions & 13 deletions PyAppDevKit/LibFunc/pyappdevkit_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,18 @@
Bu Yazılımın Bir Kopyası GİTHUB da yayınlanmaktadır Görüntülemek için: https://github.com/LinuxUsersLinuxMint/PyAppDevKit
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/PyAppDevKit"""

from LibFunc.pyappdevkit import *

PYTHON_LIB_NAME="PyAppDevKit"
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="1.6"
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="1.8"
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
PYTHON_LIB_RELEASE_DATE="6/9/2024, Time: 17:54"
PYTHON_LIB_LAST_UPDATE_DATE="1/1/2025, Time: 19:00 / 7:00 PM"
PYTHON_LIB_LAST_UPDATE_DATE="2/21/2025, Time: 22:46 / 10:46 PM"
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"

def LibAbout():
print("Python Library Name:", format(PYTHON_LIB_NAME))
print("Python Library Version:", format(PYTHON_LIB_VER))
print("Python Library Support OS:", format(PYTHON_LIB_SUPPORT_PLATFORM))
print("Python Library Licence Name:", format(PYTHON_LIB_LICENCE))
print("Python Library Implemented Contracts:", format(PYTHON_LIB_IMPLEMENTED_CONTRACTS))
print("Python Library Implemented Contracts Web Site:", format(PYTHON_LIB_IMPLEMENTED_CONTRACTS_WEB_SITE))
print("Python Library Author Name:", format(PYTHON_LIB_AUTHOR))
print("Python Library Author Web Site:", format(PYTHON_LIB_AUTHOR_WEB_SITE))
print("Python Library Release Date:", format(PYTHON_LIB_RELEASE_DATE))
print("Python Library Last Update Date:", format(PYTHON_LIB_LAST_UPDATE_DATE))
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)
8 changes: 4 additions & 4 deletions basic_maths_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

from Basic_Maths.Basic_Maths import *

LibAbout()
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]")
#LibAbout()
#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")
Expand Down

0 comments on commit 85467c5

Please sign in to comment.