摘要: for i in range(998001,888888,-1): num = str(i) start = 0 end = -1 if num[start] == num[end]: start += 1 end -= 1 if num[start] == num[end]: start +... 阅读全文
posted @ 2018-07-06 23:24 托月的成长历程 阅读(147) 评论(0) 推荐(0) 编辑
摘要: import math def isPrime(n): if n == 0 or n == 1: return False for i in range(2, int(math.sqrt(n))): if n % i == 0: return False return True def maxPrime(n... 阅读全文
posted @ 2018-07-06 20:29 托月的成长历程 阅读(138) 评论(0) 推荐(0) 编辑
摘要: fib = [1,2] i = 0 while fib[-1] < 4000000: fib.append(fib[i]+fib[i+1]) i += 1 sums = 0 for n in fib: if n % 2 == 0: sums += n print(sums) ... 阅读全文
posted @ 2018-07-06 16:26 托月的成长历程 阅读(117) 评论(0) 推荐(0) 编辑
摘要: count = 0 for i in range(1,1000): if i % 3 == 0 or i %5 ==0: count = count+i print(count) 阅读全文
posted @ 2018-07-06 16:08 托月的成长历程 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1.python2 和 python3区别python2中print可加括号可不加括号即print()或者print但是python3中必须是print()python2中有range()还有xrange()这是一个生成器但是python3中没有xrange()python2中的输入为raw_inp 阅读全文
posted @ 2018-07-06 09:17 托月的成长历程 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 字典是python中唯一的映射类型,采用键值对(key-value)的形式存储数据。python对key进行哈希函数运算,根据计算的结果决定value的存储地址,所以字典是无序存储的,且key必须是可哈希的。可哈希表示key必须是不可变类型,如:数字、字符串、元组。 字典(dictionary)是除 阅读全文
posted @ 2018-07-04 22:34 托月的成长历程 阅读(181) 评论(1) 推荐(0) 编辑
摘要: 1.一行代码更改两变量的值 阅读全文
posted @ 2018-07-04 22:34 托月的成长历程 阅读(106) 评论(0) 推荐(0) 编辑
摘要: import requests import re import tkinter #获取gethush def gethush(music): global musicname musicname = music url = 'http://songsearch.kugou.com/song_search_v2?callback=jQuery19100267857076... 阅读全文
posted @ 2018-06-28 13:55 托月的成长历程 阅读(564) 评论(0) 推荐(0) 编辑
摘要: import requests import re #获取hush值和AlbumID def gethush(): global musicname musicname = input('请输入您要下载的歌曲名字:') url = 'http://songsearch.kugou.com/song_search_v2?callback=jQuery19100267857... 阅读全文
posted @ 2018-06-27 23:44 托月的成长历程 阅读(1434) 评论(0) 推荐(0) 编辑
摘要: http://songsearch.kugou.com/song_search_v2?callback=jQuery1910026785707623246724_1490845878865&keyword=%E9%99%88%E5%A5%95%E8%BF%85&page=1&pagesize=30& 阅读全文
posted @ 2018-06-27 22:59 托月的成长历程 阅读(408) 评论(0) 推荐(0) 编辑