Skip to content

Commit 6ba0e15

Browse files
Update Basic_Maths
1 parent 9115fc5 commit 6ba0e15

File tree

8 files changed

+146
-97
lines changed

8 files changed

+146
-97
lines changed

Basic_Maths.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

Basic_Maths/Basic_Maths.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/usr/bin/python3
2+
""" Copyright© 2023-2024 LinuxUsersLinuxMint
3+
Basic_Maths Tüm Hakları GPL(Genel Kamu Lisansı) altında korunmaktadır.
4+
Basic_Maths All Rights Reserved under the GPL(General Public License).
5+
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
6+
A Copy of This Software is published on GITHUB To view: https://github.com/LinuxUsersLinuxMint/Basic_Maths"""
7+
8+
from Basic_Maths.library_func import *
9+
import time
10+
11+
global result,input_dialog,error_dialog
12+
13+
input_dialog = str()
14+
error_dialog = str()
15+
16+
def p(userString):
17+
print(userString)
18+
19+
def error_msg():
20+
p(error_dialog)
21+
22+
def exit_program_dialog_time(exit_dialog_msg,userTime):
23+
p(exit_dialog_msg)
24+
time.sleep(userTime)
25+
exit()
26+
27+
def exit_program_time(userTime):
28+
time.sleep(userTime)
29+
exit()
30+
31+
def exit_program_dialog(exit_dialog_msg):
32+
p(exit_dialog_msg)
33+
exit()
34+
35+
def program_welcome_msg(welcome_msg):
36+
p(welcome_msg)
37+
38+
def program_info(programnamedialog,program_name,programversiondialog,program_version,programsupportosdialog,program_support_os,programlicencedialog,program_licence,programauthordialog,program_author,programreleasedatedialog,program_rs_date):
39+
p("{0} {1}". format(programnamedialog,program_name))
40+
p("{0} {1}\n". format(programversiondialog,program_version))
41+
p("{0} {1}\n". format(programsupportosdialog,program_support_os))
42+
p("{0} {1}\n". format(programlicencedialog,program_licence))
43+
p("{0} {1}\n". format(programauthordialog,program_author))
44+
p("{0} {1}\n". format(programreleasedatedialog,program_rs_date))
45+
46+
47+
def InputN1N2():
48+
global number_one, number_two
49+
number_one = str(input("{0}". format(input_dialog)))
50+
number_two = str(input("{0}". format(input_dialog)))
51+
52+
select_func = str()
53+
"""
54+
Example:
55+
56+
input_select = str(input('Which process?'))
57+
select_func = input_select
58+
59+
def addition(x,y,ResultDialog):
60+
result=x+y
61+
print("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
62+
63+
"""
64+
65+
def addition(x,y,ResultDialog):
66+
result=x+y
67+
p("{0} {1} {2} + {3} = {4}". format(select_func,ResultDialog,x,y,result))
68+
69+
def Extraction(x,y,ResultDialog):
70+
result=x-y
71+
p("{0} {1} {2} - {3} = {4}". format(select_func,ResultDialog,x,y,result))
72+
73+
def Multiplication(x,y,ResultDialog):
74+
result=x*y
75+
p("{0} {1} {2} * {3} = {4}". format(select_func,ResultDialog,x,y,result))
76+
77+
def Division(x,y,ResultDialog,check_zero_control_msg):
78+
if y==0:
79+
p(check_zero_control_msg)
80+
if y>0:
81+
result=x/y
82+
p("{0} {1} {2} / {3} = {4}". format(select_func,ResultDialog,x,y,result))
83+
84+
def Percentage(x,y,ResultDialog):
85+
result=x%y
86+
p("{0} {1} {2} % {3} = {4}". format(select_func,ResultDialog,x,y,result))
87+
88+
def FullDivision(x,y,ResultDialog):
89+
result=x//y
90+
p("{0} {1} {2} // {3} = {4}". format(select_func,ResultDialog,x,y,result))
91+
92+
def TakingExponents(x,y,ResultDialog):
93+
result=x ** y
94+
p("{0} {1} {2} ** {3} = {4}". format(select_func,ResultDialog,x,y,result))
95+
96+
def TakingRoots(x,y,ResultDialog):
97+
result=x ** (1/y)
98+
p("{0} {1} {2} / (1/y) = {3}". format(select_func,ResultDialog,x,result))
99+
100+
def SqaureRoot(x,ResultDialog):
101+
result=x ** (1/2)
102+
p("{0} {1} {2} ** (1/2) = {3}". format(select_func,ResultDialog,x,result))

lib_ver_info.py renamed to Basic_Maths/lib_ver_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77

88
PYTHON_LIB_NAME="Basic_Maths"
99
PYTHON_LIB_LICENCE="GPL2"
10-
PYTHON_LIB_VER="2.7"
10+
PYTHON_LIB_VER="3.0"
11+
PYTHON_LIB_SUPPORT_PLATFORM="Windows/Linux/macOS"
12+
PYTHON_LIB_RELEASE_DATE="5/24/2024, Time: 21:19"
1113
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"

library_func.py renamed to Basic_Maths/library_func.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
from lib_ver_info import *
1111

12+
def p(userString):
13+
print(userString)
14+
1215
def LibAbout():
13-
print("Python Library Name: {0}", format(PYTHON_LIB_NAME))
14-
print("Python Library Version: {0}\n", format(PYTHON_LIB_VER))
15-
print("Python Library Licence Name: {0}\n", format(PYTHON_LIB_LICENCE))
16-
print("Python Library Author Name: {0}\n", format(PYTHON_LIB_AUTHOR))
16+
p("Python Library Name: {0}", format(PYTHON_LIB_NAME))
17+
p("Python Library Version: {0}\n", format(PYTHON_LIB_VER))
18+
p("Python Library Support OS: {0}\n", format(PYTHON_LIB_SUPPORT_PLATFORM))
19+
p("Python Library Licence Name: {0}\n", format(PYTHON_LIB_LICENCE))
20+
p("Python Library Author Name: {0}\n", format(PYTHON_LIB_AUTHOR))
21+
p("Python Library Release Date: {0}\n", format(PYTHON_LIB_RELEASE_DATE))
1722

1823
# TR (Türkçe):
1924
# NOT: "Kütüphane fonksiyonları" başlığı altındaki fonksiyonlar kullanımı isteğe bağlıdır ancak "Basic_Maths" kütüphanesini kullanan bir "Python" yazılımında kullanıcıya kullanılan kütüphane hakkında bilgi vermek amacıyla kullanılabilir.

Example/basic_maths_calc.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,33 @@
44
It is a example program made with Basic_Maths. It was written to serve as an example of (Basic_Maths) usage.
55
Sharing of the file named "basic_maths_calc.py" in posts (blog/post etc. on the internet) has been given permission by @LinuxUsersLinuxMint. """
66

7-
from Basic_Maths import *
8-
number1=int(input('N1: '))
9-
number2=int(input('N2: '))
10-
select=str(input('Select (Add, Ext, Mul, Div, Per, FullDiv, TakeEx): '))
7+
from ..Basic_Maths.Basic_Maths import *
8+
9+
input_dialog = str("Enter the number: ")
10+
error_dialog = str("Invalid process...")
11+
resultdialog = str("Result:")
12+
13+
InputN1N2()
14+
15+
select=print('Select (Add, Ext, Mul, Div, Per, FullDiv, TakeEx): ')
1116

1217
input_select = str(input('Which process?'))
1318
select_func = input_select
14-
resultdialog = str("Result:")
19+
1520

1621
if select=="Add":
17-
addition(number1,number2,resultdialog)
22+
addition(number_one,number_two,resultdialog)
1823
elif select=="Ext":
19-
Extraction(number1,number2,resultdialog)
24+
Extraction(number_one,number_two,resultdialog)
2025
elif select=="Mul":
21-
Multiplication(number1,number2,resultdialog)
26+
Multiplication(number_one,number_two,resultdialog)
2227
elif select=="Div":
23-
Division(number1,number2,resultdialog)
28+
Division(number_one,number_two,resultdialog,"The second number cannot be zero in division!")
2429
elif select=="Per":
25-
Percentage(number1,number2,resultdialog)
30+
Percentage(number_one,number_two,resultdialog)
2631
elif select=="FullDiv":
27-
FullDivision(number1,number2,resultdialog)
32+
FullDivision(number_one,number_two,resultdialog)
2833
elif select=="TakeEx":
29-
TakingExponents(number1,number2,resultdialog)
34+
TakingExponents(number_one,number_two,resultdialog)
3035
else:
31-
print("Invalid Process...!")
36+
error_msg()

install.bat

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
copy Basic_Maths.py YOU_PY_LIB_PATH
1+
@echo off
2+
@title Basic_Maths Install
3+
4+
set /p usrpath=You Python Path:
5+
pause
6+
echo install Basic_Maths
7+
copy Basic_Maths\Basic_Maths.py %usrpath%
8+
copy Basic_Maths\lib_ver_info.py %usrpath%
9+
copy Basic_Maths\library_func.py %usrpath%
10+
pause
11+
exit

install.bat_readme.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/usr/bin/bash
22

3-
sudo cp Basic_Maths.py /usr/lib/python3.10/
3+
sudo cp Basic_Maths/Basic_Maths.py /usr/lib/python3.10/
4+
sudo cp Basic_Maths/lib_ver_info.py /usr/lib/python3.10/
5+
sudo cp Basic_Maths/library_func.py /usr/lib/python3.10/

0 commit comments

Comments
 (0)