摘要:
float('66.6') 转为浮点数 int() str() pep8规范 成员运算符 :in / not in 逻辑运算符:and or count()统计次数, 字符串名.count() 字符串名.isdigit() #统计字符串是不是全都为数字 字符串名.isalpha()#统计字符串是不是 阅读全文
posted @ 2019-08-28 12:02
晓亮86
阅读(149)
评论(0)
推荐(0)
摘要:
1 # 普通方法 2 year = int(input('请输入年份:')) 3 month = int(input('请输入月份(1~12):')) 4 if month == 2: 5 if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: 6 print('闰年29天') 7 else: 8 print('平年28天') 9 10 e 阅读全文
posted @ 2019-08-28 11:53
晓亮86
阅读(5223)
评论(0)
推荐(0)
摘要:
1 num = int(input('请输入性别男(1)女(2)')) 2 h =int(input('请输身高')) 3 if num == 1: 4 print((h-80)*0.7) 5 elif num == 2: 6 print((h-80)*0.6) 7 else: 8 print('输入有误') 阅读全文
posted @ 2019-08-28 10:18
晓亮86
阅读(2605)
评论(0)
推荐(0)