07 2019 档案

摘要:'''已知一组数据规律如下:1,-2,3,-4,5,-6,7,-8.......-100求出这些数字加起来的和 sum=1-2+3-4......-100'''l=[]for i in range(1,101): if i%2 ==0: l.append(-i) else: l.append(i)p 阅读全文
posted @ 2019-07-19 09:42 by2018 阅读(2239) 评论(0) 推荐(0)
摘要:def bubbleSort(arr,length): for j in range(length): for i in range(length-1): if arr[i] > arr[i+1]: arr[i],arr[i+1] = arr[i+1],arr[i] return arrif __n 阅读全文
posted @ 2019-07-19 09:04 by2018 阅读(188) 评论(0) 推荐(0)
摘要:import pymysql# 打开数据库连接def db_insert(sql_insert): db = pymysql.connect(host='47.104.*.*', port=3308, user='root', passwd='123456', db='ernest') # 使用cu 阅读全文
posted @ 2019-07-19 09:03 by2018 阅读(403) 评论(0) 推荐(1)
摘要:import pymysql# 打开数据库连接db = pymysql.connect(host='47.104.*.*', #数据库服务器IP port=3308, user='root', passwd='123456', db='ernest' #数据库名称)# 使用cursor()方法创建一 阅读全文
posted @ 2019-07-17 09:25 by2018 阅读(4615) 评论(0) 推荐(1)
摘要:如果一个 3 位数等于其各位数字的立方和,则称这个数为水仙花数。 例如:153 = 1^3 + 5^3 + 3^3,因此 153 就是一个水仙花数 例如:153 = 1^3 + 5^3 + 3^3,因此 153 就是一个水仙花数 求1000以内的水仙花数(3位数) 求1000以内的水仙花数(3位数) 阅读全文
posted @ 2019-07-16 08:02 by2018 阅读(42108) 评论(0) 推荐(0)