Write the program to get the output of the given expression
1×2×3
Answers
Answered by
7
The given problem is solved using language - Python.
expression='1 * 2 * 3'
result=eval(expression)
print('Expression: '+expression)
print('Result:',result)
- Line 1: Stores the expression given.
- Line 2: Evaluates the given expression using eval() method.
- Line 3: Prints the expression given.
- Line 4: Prints the result after evaluating the expression.
See attachment for output.
Attachments:
Similar questions