代码展示

x=eval(input("请输入一个整数:"))
if type(x) is type(2):#还可以用x%1==0来判断
    print("它的平方为:{}".format(x**2))
else:
    print("输入错误!")

要点

eval使用