Commit c9e2833a by arun.uday

v1

parent 4a324fa8
# 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")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment