Solution to Calculator using functions in Python

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()

1 Like