可爱的python习题答案status校对lizzie完成度100%CDays-51
计算今年是闰年嘛
判断闰年条件,满足年份模400为0,或者模4为0但模100不为0
o源代码Togglelinenumbers1#coding:utf-82'''cdays-5-exercise-1
py判断今年是否是闰年3@note:使用了import,time模块,逻辑分支,字串格式化等4'''56importtime#导入time模块7thisyear=time
localtime()[0]#获取当前年份8ifthisyear%400==0orthisyear%4==0andthisyear%1000:#判断闰年条件,满足模400为0,或者模4为0但模100不为09print'thisyear%sisaleapyear'%thisyear10else:11print'thisyear%sisnotaleapyear'%thisyear12o运行截屏2
利用python作为科学计算器
熟悉Python中的常用运算符,并分别求出表达式12*34+78-132/6、(12*(34+78)-132)/6、(86/40)**5的值
并利用math模块进行数学计算,分别求出145/23的余数,0
5的sin和cos值(注意sin和cos中参数是弧度制表示)提醒:可通过importmath;help("math")查看math帮助
o源代码Togglelinenumbers1#coding:utf-82'''cdays-5-exercise-2
py求表达式的值3@note:基本表达式运算,格式化输出,math模块4@see:math模块使用可参考http://docs