第1关气温预测 def dailyTemps(temp_list): result = [] for ca in range(0, len(temp_list)-1): for i in range(ca + 1, len(temp_list)): ind = temp_list[ca] flag = 0 if (temp_list[i] > ind): result.append(i - ca) flag = 1 break if (flag == 0): result.append(0) r…
第1关求和 class Task: def getSum(self, num1, num2): sum = 0 for i in range(num1, num2 + 1): while (i != 0): sum += i % 10 i /= 10 i = int(i) return sum if __name__ == '__main__': task = Task a = task.getSum(task, 15, 19) print(a) 第2关文件查看器 import os, sys…
<?php /* * * MySQL_5.5中文参考手册 485开始 * * mysql> SELECT CASE 1 WHEN 1 THEN 'one' -> WHEN 2 THEN 'two' ELSE 'more' END; -> 'one' mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END; -> 'true' mysql> SELECT CASE BINARY 'B' -> WH…
时间段统计========== 按年汇总,统计:select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y'); 按月汇总,统计:select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y-%m'); 按季度汇总,统计:select…