Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Calculator Python code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vipul.v
Calculator Python code
Commits
d7e8996a
Commit
d7e8996a
authored
Mar 07, 2023
by
vipul.v
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete main.py
parent
51082e4c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
48 deletions
+0
-48
main.py
main.py
+0
-48
No files found.
main.py
deleted
100644 → 0
View file @
51082e4c
class
calculator
:
def
sum
(
self
,
x
,
y
):
return
x
+
y
def
difference
(
self
,
x
,
y
):
return
x
-
y
def
multiplication
(
self
,
x
,
y
):
return
x
*
y
def
division
(
self
,
x
,
y
):
return
x
/
y
my_function
=
calculator
()
while
True
:
print
()
print
(
"CHOICE 1: SUM"
)
print
(
"CHOICE 2: DIFFERENCE"
)
print
(
"CHOICE 3: MULTIPLICATION"
)
print
(
"CHOICE 4: DIVISION"
)
print
(
"CHOICE 5: EXIT"
)
print
()
choice
=
int
(
input
(
"Enter a choice: "
))
print
()
if
choice
not
in
[
1
,
2
,
3
,
4
,
5
]:
print
(
"Please, enter a valid Input"
)
elif
choice
==
5
:
break
else
:
x
=
int
(
input
(
"Enter first number: "
))
y
=
int
(
input
(
"Enter second number: "
))
if
(
choice
==
1
):
print
(
"RESULT -->"
,
x
,
"+"
,
y
,
"="
,
my_function
.
sum
(
x
,
y
))
elif
(
choice
==
2
):
print
(
"RESULT -->"
,
x
,
"-"
,
y
,
"="
,
my_function
.
subtraction
(
x
,
y
))
elif
(
choice
==
3
):
print
(
"RESULT -->"
,
x
,
"*"
,
y
,
"="
,
my_function
.
multiplication
(
x
,
y
))
elif
(
choice
==
4
):
print
(
"RESULT -->"
,
x
,
"/"
,
y
,
"="
,
my_function
.
division
(
x
,
y
))
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment