Skip to content

Commit

Permalink
Update Basic_Maths.
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxUsersLinuxMint authored Feb 10, 2025
1 parent 2852fbd commit b7a09e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 51 deletions.
61 changes: 12 additions & 49 deletions Basic_Maths/Basic_Maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,45 @@

from Basic_Maths.Lib.lib import *

""" TR (Turkish / Türkçe):
NOT: InputN1N2() sadece 2 sayının istendiği durumlarda kullanılabilir.
EN (English / İngilizce):
NOTE: InputN1N2() can be used when only 2 numbers are required. """

def InputN1N2(number_one_dialog,number_two_dialog):
global number_one, number_two
number_one = float(input("{0}". format(number_one_dialog)))
number_two = float(input("{0}". format(number_two_dialog)))

select_func = str()
"""
Example:
input_select = str(input('Which process?'))
select_func = input_select
def Addition(x,y,ResultDialog):
result=x+y
print("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
"""

def Addition(x,y,ResultDialog):
result=x+y
print("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} + {2} = {3}". format(ResultDialog,x,y,x+y))

def Extraction(x,y,ResultDialog):
result=x-y
print("{0} {1} {2} - {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} - {2} = {3}". format(ResultDialog,x,y,x-y))

def Multiplication(x,y,ResultDialog):
result=x*y
print("{0} {1} {2} * {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} * {2} = {3}". format(ResultDialog,x,y,x*y))

def Division(x,y,ResultDialog,check_zero_control_msg):
if x==0 or y==0:
print(check_zero_control_msg)
if y>0 and x>0:
result=x/y
print("{0} {1} {2} / {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,x/y))

def Percentage(x,y,ResultDialog):
result = (x*y)/100
print("{0} {1} ({2} * {3})/100 = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} ({1} * {2})/100 = {3}". format(ResultDialog,x,y,(x*y)/100))

def Mod(x,y,ResultDialog):
result=x%y
print("{0} {1} {2} % {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} % {2} = {3}". format(ResultDialog,x,y,x%y))

def FullDivision(x,y,ResultDialog):
result=x//y
print("{0} {1} {2} // {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} // {2} = {3}". format(ResultDialog,x,y,x//y))

def TakingExponents(x,y,ResultDialog):
result=x ** y
print("{0} {1} {2} ** {3} = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} ** {2} = {3}". format(ResultDialog,x,y,x**y))

def TakingRoots(x,y,ResultDialog):
result=x ** (1/y)
print("{0} {1} {2} / (1/{3}) = {4}". format(select_func,ResultDialog,x,y,result))
print("{0} {1} / (1/{2}) = {3}". format(ResultDialog,x,y,x**(1/y)))

def SqaureRoot(x,ResultDialog):
result=x ** (1/2)
print("{0} {1} {2} ** (1/2) = {3}". format(select_func,ResultDialog,x,result))
print("{0} {1} ** (1/2) = {2}". format(ResultDialog,x,x**(1/2)))

""" 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.
NOT2: "select_process" değişkeni ile geliştiriciler isteğe bağlı olarak programlarında kullanıcılar tarafından seçilen işlemi gösterebilir.
NOT3: "nod" ve "ntd" değişkenleri ile beraber geliştiriciler "all_math_operations()" fonksiyonunda "InputN1N2()" fonksiyonunu kullanabilir ve bu değişkenler aracılığıyla 1. sayı ve 2. sayı diyaloglarını ekleyebilirler.
Ö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.
EN (English / İngilizce):
NOTE: Developers using the "Basic_Maths" library can change the "Basic_Maths" functions according to the needs of their programs.
NOTE2: With the "select_process" variable, developers can optionally display the process selected by users in their programs.
NOTE3: Along with the "nod" and "ntd" variables, developers can use the "InputN1N2()" function in the "all_math_operations()" function and add the 1st issue and 2nd issue dialogs through these variables.
SUGGESTION: If your wishes or needs are different, it is recommended that you change it according to your needs before using the "all_math_operations()" function. """

def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_dialog,fourth_opt_dialog,fifth_opt_dialog,sixth_opt_dialog,seventh_opt_dialog,eighth_opt_dialog,ninth_opt_dialog,tenth_opt_dialog,SelectOptDialog,nod,ntd,resdialog,divisionzerocheckdialog,errdg,addition_options_one,addition_options_two,addition_options_three,addition_options_four,addition_options_five,extraction_options_one,extraction_options_two,extraction_options_three,extraction_options_four,extraction_options_five,multiplication_options_one,multiplication_options_two,multiplication_options_three,multiplication_options_four,multiplication_options_five,division_options_one,division_options_two,division_options_three,division_options_four,division_options_five,percentage_options_one,percentage_options_two,percentage_options_three,percentage_options_four,percentage_options_five,fulldivision_options_one,fulldivision_options_two,fulldivision_options_three,fulldivision_options_four,fulldivision_options_five,takingexponents_options_one,takingexponents_options_two,takingexponents_options_three,takingexponents_options_four,takingexponents_options_five,takingroots_options_one,takingroots_options_two,takingroots_options_three,takingroots_options_four,takingroots_options_five,squareroot_options_one,squareroot_options_two,squareroot_options_three,squareroot_options_four,squareroot_options_five,mod_options_one,mod_options_two,mod_options_three,mod_options_four,mod_options_five):
Expand All @@ -99,7 +61,8 @@ def all_math_operations(optDialog,first_opt_dialog,second_opt_dialog,third_opt_d
print(ninth_opt_dialog)
print(tenth_opt_dialog)
select_func = str(input(SelectOptDialog))
InputN1N2(nod,ntd)
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)
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:
Expand Down
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/en/privacyandsecutryagreement.html , https://linuxuserslinuxmint.github.io/Contracts/linuxuserslinuxmintwebsiteagreement/en/linuxuserslinuxmintwebsiteagreement.html"
PYTHON_LIB_VER="5.3"
PYTHON_LIB_VER="5.5"
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS/otherOS"
PYTHON_LIB_RELEASE_DATE="9/30/2023, Time: XX:XX"
PYTHON_LIB_LAST_UPDATE_DATE="1/5/2025, Time: 20:43 / 8:43 PM"
PYTHON_LIB_LAST_UPDATE_DATE="2/10/2025, Time: 20:53 / 8:53 PM"
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"
PYTHON_LIB_AUTHOR_WEB_SITE="https://linuxuserslinuxmint.github.io"

0 comments on commit b7a09e1

Please sign in to comment.