1、输出正方形
x=input("请输入:")
x=int(x)
for i in range(0,x):
if (i==0) or (i==x-1):
print("**"*x)
else:
print("*"," "*(x-2),"*")
2、判断闰年
year = input("请输入年份:")
year=int(year)
if (year % 4 == 0 ) and (year % 100 != 0) or (year % 400 == 0):
print(year,"是闰年")
else:
print(year,"是平年")
3、摄氏度转华氏度
C=float(input("请输入摄氏度:"))
F=1.8 * C + 32
print('{} 摄氏度={} 华氏度'.format(C,F))
4、计算圆的周长和面积
radius=float(input("请输入半径:"))
perimeter=3.14*2*radius
area=3.14*radius**2
print("半径为%f,周长为%f,面积为%f"%(radius,perimeter,area))
5、判断水仙花数
number = input("请输入数字:")
if len(number)>3:
print("!err")
else:
bai= int(number[0])
shi = int(number[1])
ge = int(number[2])
if bai**3+shi**3+ge**3==int(number):
print("水仙花数")
else:
print("不是")