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 24, 2024
1 parent 27ef283 commit e522e4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
11 changes: 9 additions & 2 deletions Basic_Maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

global result

PYTHON_LIB_LICENCE="GPL2"
PYTHON_LIB_VER="2.0"
PYTHON_LIB_AUTHOR="LinuxUsersLinuxMint"

def addition(x,y,ResultDialog):
x=x
y=y
Expand All @@ -25,8 +29,11 @@ def Multiplication(x,y,ResultDialog):
def Division(x,y,ResultDialog):
x=x
y=y
result=x/y
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,result))
if y=0:
print("The second number cannot be zero in division!")
if y>0:
result=x/y
print("{0} {1} / {2} = {3}". format(ResultDialog,x,y,result))
def Percentage(x,y,ResultDialog):
x=x
y=y
Expand Down
19 changes: 11 additions & 8 deletions Example/basic_maths_calc.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
#!/usr/bin/python3
# Basic_Maths ile yapılmış bir calcutator programıdır. (Basic_Maths) kullanımına örnek olması amaçlı yazılmıştır.
# It is a calculator program made with Basic_Maths. It was written to serve as an example of (Basic_Maths) usage.

from Basic_Maths import *
number1=int(input('N1: '))
number2=int(input('N2: '))
select=str(input('Select (Add, Ext, Mul, Div, Per, FullDiv, TakeEx): '))

resultdialog = str("Result:")

if select=="Add":
addition(number1,number2,"Result:")
addition(number1,number2,resultdialog)
elif select=="Ext":
Extraction(number1,number2,"Result:")
Extraction(number1,number2,resultdialog)
elif select=="Mul":
Multiplication(number1,number2,"Result:")
Multiplication(number1,number2,resultdialog)
elif select=="Div":
Division(number1,number2,"Result:")
Division(number1,number2,resultdialog)
elif select=="Per":
Percentage(number1,number2,"Result:")
Percentage(number1,number2,resultdialog)
elif select=="FullDiv":
FullDivision(number1,number2,"Result:")
FullDivision(number1,number2,resultdialog)
elif select=="TakeEx":
TakingExponents(number1,number2,"Result:")
TakingExponents(number1,number2,resultdialog)
else:
print("Invalid Process...!")
print("Invalid Process...!")

0 comments on commit e522e4f

Please sign in to comment.