#1.一个时间格式的整数:20201020,利用计算出它的年月日
time = 20201020
print(f'{time//10000}年{time//100%100}月{time%100}日')
#2.将多个单词利用字符串拼接,输出成一句话
print('I '+'love '+'you')
#3.计算出圆的周长和面积
import math
r = input('请输入圆的半径: ')
c = 2*math.pi*int(r)
s = math.pi*math.pow(int(r),2)
print('圆的周长为:%5.2f\n圆的面积为:%5.2f'%(c,s))
python初学者三道基础题
最新推荐文章于 2024-07-17 20:34:27 发布