RosettaCodeData/Task/Arithmetic-Integer/Python/arithmetic-integer-3.py

9 lines
227 B
Python

def arithmetic(x, y):
for op in "+ - * // % **".split():
expr = "%(x)s %(op)s %(y)s" % vars()
print("%s\t=> %s" % (expr, eval(expr)))
arithmetic(12, 8)
arithmetic(input("Number 1: "), input("Number 2: "))