# Solution to Calculator using functions in Python

**URL:** <https://forum.codewithmosh.com/t/solution-to-calculator-using-functions-in-python/28585>\
**Category:** Python\
**Created:** [September 6, 2024, 2:48pm UTC](https://forum.codewithmosh.com/t/solution-to-calculator-using-functions-in-python/28585 "2024-09-06T14:48:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gourav97](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/gourav97/32/8436_2.png) [@Gourav97](https://forum.codewithmosh.com/u/Gourav97)\
**Post date:** [September 6, 2024, 2:48pm UTC](https://forum.codewithmosh.com/t/solution-to-calculator-using-functions-in-python/28585/1 "2024-09-06T14:48:47Z")

</div>

Here is the solution to Calculator using functions in Python which is given below:

def main():  
x = float(input("Input first number: "))  
y = float(input("Input second number: "))

```
print("Addition: {0:.2f}".format(x + y))
print("Subtraction: {0:.2f}".format(x - y))
print("Multiplication: {0:.2f}".format(x * y))
print("Division: {0:.2f}".format(x / y))

```

if **name** == ‘ **main** ’:  
main()
