Python123 part Exercises

 

Numerical computation

description

Obtaining user input of a character string, the following format:

M ON A

Wherein, M and N is any number that represents OP an operation expressed as the following four: +, -, *, / (addition, subtraction)

The OP in accordance with the calculation result, the output M OP N, unified storage for 2 decimal places.

Note: there may be a plurality of spaces between M and OP, OP, and N, the input is not considered an error condition.

Example O
             Entry                          Export             
    Example 1    

10 + 100

1/20

11.00

0.05

answer:

 

result=eval(input())
print("{:.2f}".format(result))

 

Guess you like

Origin www.cnblogs.com/NoahFang/p/11322435.html