实验任务2

r1 = eval('1 + 2')
print(type(r1), r1)
r2 = eval('[1, 6, 7.5]')
print(type(r2), r2)
r3 = eval('"python"')
print(type(r3), r3)
r4 = eval('7, 42')
print(type(r4), r4)

1 x, y = eval(input('Enter two oprands: '))
2 ans = x + y
3 print(f'{x} + {y} = {ans}')
4 print(f'{type(x)} + {type(y)} = {type(ans)}')

 

posted @ 2022-03-23 17:23  张博睿  阅读(6)  评论(0编辑  收藏  举报