PROGRAMMING:Four operations (realized by Dictionary)
Four operations (implemented by Dictionary), comparing the switch statements of C language.
###Input format:
Enter a number on a line
Enter a four flag operator (+,, *, /) on a line
Enter a number on a line
###Output format:
Output the result in one line (2 decimal places reserved)
###Input sample 1:
Here is a set of inputs. For example:
```in
seven
/
three
```
###Output sample 1:
The corresponding output is given here. For example:
```out
two point three three
```
###Input sample 2:
Here is a set of inputs. For example:
```in
ten
/
0
```
###Output sample 2:
The corresponding output is given here. For example:
```out
divided by zero
```
answer:If there is no answer, please comment
```
#%% four operations
result={"+":"x+y","-":"x-y","*":"x*y","/":'''x/y if y!= 0 \
else "divided by zero"'''}
x=int(input())
z=input().strip()
y=int(input())
r=eval(result.get(z))
if type(r)!= str:
print(format(r,'.2f'))
else:
print(r)
```
###Input format:
Enter a number on a line
Enter a four flag operator (+,, *, /) on a line
Enter a number on a line
###Output format:
Output the result in one line (2 decimal places reserved)
###Input sample 1:
Here is a set of inputs. For example:
```in
seven
/
three
```
###Output sample 1:
The corresponding output is given here. For example:
```out
two point three three
```
###Input sample 2:
Here is a set of inputs. For example:
```in
ten
/
0
```
###Output sample 2:
The corresponding output is given here. For example:
```out
divided by zero
```
answer:If there is no answer, please comment
```
#%% four operations
result={"+":"x+y","-":"x-y","*":"x*y","/":'''x/y if y!= 0 \
else "divided by zero"'''}
x=int(input())
z=input().strip()
y=int(input())
r=eval(result.get(z))
if type(r)!= str:
print(format(r,'.2f'))
else:
print(r)
```