RosettaCodeData/Task/Arithmetic-Integer/Python/arithmetic-integer-3.py
2023-07-01 13:44:08 -04:00

8 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: "))