Suppose I have this code:
int1 = (2 + 2) * 4
print(int1)
OUTPUT: 16
But is there a way to print the math of the int without using a string instead? Like a literal()
function or something?
Example program:
int1 = 2 + 2
int2 = 4
print('{} times {} equals:'.format(literal(int1), literal(int2))
print(int1 * int2)
OUTPUT:
2 + 2 times 4 equals:
16
I kind of feel like I'm looking for a solution to a problem that doesn't exist, but I'm new to Python and I'm curious.