Skip to content

Commit

Permalink
first project
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaryan72 committed Nov 14, 2024
1 parent 4b3b3aa commit 7eaf9ea
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 0 deletions.
69 changes: 69 additions & 0 deletions 1.Caluclator/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Make a calculator
# perform all operations
# use switch case and if else condition
# ask to perform calculation again if yes repeat else exit




def addition(a,b):
return a+b

def subtraction(a,b):
return a-b

def multiplication(a,b):
return a*b

def division(a,b):
return a//b



def calculator():
while True:
try:
a = int(input("Enter your first number :"))
b = int(input("Enter your second number :"))
except ValueError:
print("Invalid input")
continue

print("Operations:")
print("1.Addition")
print("2.Subtraction")
print("3.Multiplication")
print("4.Division")
print("5.Exit")

ch = input("Enter your choice :")

if ch == '1':
result = addition(a,b)
print(f"The addition of both numbers is:{result}")

elif ch == '2':
result = subtraction(a,b)
print(f"The addition of both numbers is:{result}")

elif ch == '3':
result = multiplication(a,b)
print(f"The addition of both numbers is:{result}")

elif ch == '4':
result = division(a,b)
print(f"The addition of both numbers is:{result}")

elif ch == '5':
exit()

else:
print("Invalid input")

repeat = input("Do you want to perform another calculation? (y/n): ")
if repeat!= 'y':
print("Exiting the calculator. Goodbye!")
break


calculator()
15 changes: 15 additions & 0 deletions 1.Caluclator/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions 1.Caluclator/node_modules/python/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions 1.Caluclator/node_modules/python/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions 1.Caluclator/node_modules/python/example/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions 1.Caluclator/node_modules/python/lib/python.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions 1.Caluclator/node_modules/python/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions 1.Caluclator/node_modules/python/test/python.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions 1.Caluclator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions 1.Caluclator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"python": "^0.0.4"
}
}

0 comments on commit 7eaf9ea

Please sign in to comment.