Commit b73dac63 authored by vidya.m's avatar vidya.m

first commit

parents
# Default ignored files
/shelf/
/workspace.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (pythonProject3)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject3.iml" filepath="$PROJECT_DIR$/.idea/pythonProject3.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
class Calculator:
def __init__(self, num1, num2):
self.num1 = num1
self.num2 = num2
def add(self):
return self.num1 + self.num2
def subtract(self):
return self.num1 - self.num2
def multiply(self):
return self.num1 * self.num2
def Divide(self):
return self.num1 / self.num2
print("Select the operation:\n" \
" 1. Add\n " \
" 2. Subtract\n" \
" 3. Multiply\n" \
" 4. Divide\n" \
)
select = int(input("Select the operation\n"))
num1 = int(input("Enter the first number:\n"))
num2 = int(input("Enter the second number:\n"))
my_Result = Calculator(num1, num2)
if select == 1:
print(num1, "+", num2, "=", my_Result.add())
elif (select == 2):
print(num1, "-", num2, "=", my_Result.subtract())
elif (select == 3):
print(num1, "*", num2, "=", my_Result.multiply())
elif (select == 4):
print(num1, "/", num2, "=", my_Result.Divide())
else:
print("invalid number")
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