Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KL_Internship
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
arun.uday
KL_Internship
Commits
c9e2833a
Commit
c9e2833a
authored
Jan 16, 2023
by
arun.uday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1
parent
4a324fa8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
10 deletions
+38
-10
main.py
+38
-10
No files found.
main.py
View file @
c9e2833a
# This is a sample Python script.
# function to add
def
add
(
number1
,
number2
):
return
number1
+
number2
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
# function to subtract
def
subtract
(
number1
,
number2
):
return
number1
-
number2
def
print_hi
(
name
):
# Use a breakpoint in the code line below to debug your script.
print
(
f
'Hi, {name}'
)
# Press Ctrl+F8 to toggle the breakpoint.
#
Press the green button in the gutter to run the script.
#
function to multiply
if
__name__
==
'__main__'
:
def
multiply
(
number1
,
number2
)
:
print_hi
(
'PyCharm'
)
return
number1
*
number2
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
# function to divide
def
divide
(
number1
,
number2
):
return
number1
/
number2
# function to find remainder
def
remainder
(
number1
,
number2
):
return
number1
%
number2
# Input values
numb1
=
int
(
input
(
"Enter the first number"
))
numb2
=
int
(
input
(
"Enter the second number"
))
operator
=
input
(
"Enter the operator"
)
# Calculate
if
operator
==
'+'
:
print
(
"Sum : "
,
add
(
numb1
,
numb2
))
elif
operator
==
'-'
:
print
(
"Subtract : "
,
subtract
(
numb1
,
numb2
))
elif
operator
==
'*'
:
print
(
"Product : "
,
multiply
(
numb1
,
numb2
))
elif
operator
==
'/'
:
print
(
"Division : "
,
divide
(
numb1
,
numb2
))
elif
operator
==
'
%
'
:
print
(
"Remainder : "
,
remainder
(
numb1
,
numb2
))
else
:
print
(
"Invalid Operator"
)
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