python
慕容抗天
这个作者很懒,什么都没留下…
展开
-
python(官网)初体验以及学习目标(flag)
Life is short, you need Python。 第一次上python官网仅仅是为了下载python,按照老师的说法,一路下来用三个方法一路打出了“Hello,World”。 在用python向世界打招呼之后,就算是正式开始了学习、应用python的旅途。 第二次上python官网就要好好的浏览浏览了。 1:必须承认的是,上面有很多东西是我看不懂得,比...原创 2018-03-07 10:57:39 · 1148 阅读 · 0 评论 -
第十章部分习题
10 - 1 with open('a.txt') as text: all = text.read() print(all)with open('a.txt') as text: for line in text : print(line.rstrip())with open('a.txt') as text: lines = text.readlines()print (lines) 1...原创 2018-04-02 09:03:43 · 806 阅读 · 0 评论 -
第一个简单爬虫之下载小说
仅做学习用途!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!看小说请支持正版!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!做了小飞船打外星人之后,课本剩下的两个大项目都不想做,一个看都没看,一个做起来越做越生气。于是把目光放到了我康康康康康康康!!!仙博客更新过的 python爬虫上找到了一个比较傻瓜式的简单博客教程,开始了py...原创 2018-03-29 11:39:22 · 2032 阅读 · 8 评论 -
第八章部分习题
8.1def display_message(): msg = "helllooooooo!!!" print(msg)display_message()8-2def book(name): """哈哈哈哈""" print("one of my favorite books is " + name + " !")name = "312"book原创 2018-03-29 14:24:29 · 203 阅读 · 0 评论 -
leetcode 23 合并n个链表
Definition for singly-linked list.Merge K Sorted Lists (#23)Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->...原创 2018-04-30 21:56:39 · 345 阅读 · 0 评论 -
leetcod 213 House Robber II
After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in a ci...原创 2018-04-30 22:01:50 · 152 阅读 · 0 评论 -
leetcode 4. 两个排序数组的中位数
给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 。请找出这两个有序数组的中位数。要求算法的时间复杂度为 O(log (m+n)) 。示例 1:nums1 = [1, 3] nums2 = [2]中位数是 2.0 示例 2:nums1 = [1, 2] nums2 = [3, 4]中位数是 (2 + 3)/2 = 2.5思路: 两个数组合并,然...原创 2018-04-23 22:10:40 · 130 阅读 · 0 评论 -
python作业之numpy and scipy
import numpyfrom scipy import linalgimport timeA = numpy.random.normal(size=(200, 500))B = linalg.toeplitz(list(range(0,500)))'''1def ex1(A,B,X): I = numpy.eye(500) print(numpy.dot(A...原创 2018-05-18 15:02:36 · 484 阅读 · 0 评论 -
python作业之scipy
题目: 1:`import numpy as np A = np.random.randint(-20, 20, size = 30 * 20).reshape(30, 20) b = np.random.randint(-20, 20, size = 30 * 1).reshape(30, 1) x = np.dot(np.dot(np.linalg.inv(np.dot(A...原创 2018-06-04 00:10:48 · 380 阅读 · 0 评论 -
pyhton作业之matplotlib
题目:1:`import numpy import matplotlib.pyplot X = numpy.arange(0, 2.00, 0.02) Y = numpy.sin((X - 2) * numpy.exp(-X * 2)) * 2 matplotlib.pyplot.plot(X, Y) matplotlib.pyplot.title(“A function”)...原创 2018-05-28 17:19:20 · 228 阅读 · 0 评论 -
python作业之pandas seaborn
题目为:Part 1 For each of the four datasets…Compute the mean and variance of both x and y Compute the correlation coefficient between x and y Compute the linear regression line: y=β0+β1x+ϵy=β0+β1x...原创 2018-06-12 00:26:19 · 348 阅读 · 0 评论 -
python作业之sklearn
题目:1 Create a classification dataset (n samples 1000, n features 10) 2 Split the dataset using 10-fold cross validation 3 Train the algorithms GaussianNB SVC (possible C values [1e-02, 1e-01,...原创 2018-06-17 21:05:04 · 352 阅读 · 0 评论 -
第九章部分习题
9-1:class Restaurant(): def __init__(self): self.name = "fandian" self.type = "hahaha" def print(self): print(self.name + self.type) def working(self): print (" restaurant is working now ")a = Res...原创 2018-04-02 08:37:17 · 333 阅读 · 0 评论 -
第二个简单爬虫之爬取动态网站图片
留着先,有空写原创 2018-04-09 14:05:34 · 527 阅读 · 2 评论 -
第二章部分习题
2-2 a="123" print (a) a="456" print(a)2-4name = "mary"print(name.lower())print(name.upper())print(name.title())2-7name = " mary "print(name.lstrip())print(name.rstrip())print(name.strip...原创 2018-03-07 22:45:39 · 369 阅读 · 0 评论 -
第十三章 【pygame】创造外星人并射死他们并建立失败条件
在十二章中,我们完成了pip pygame的下载,完成了准备工作,在代码中也实现了飞船的上下左右四个方向的移动,并且确保了不会飞机不会飞出屏幕。同时,也让飞机能够发射出矩形状的子弹,并设置了子弹的数量限制,控制了子弹的飞行速度,还在子弹飞出屏幕的时候,删除该子弹以节省内存。 再进一步,在第十三章中,我们要依次完成以下功能 1:创建一个在左上角的外星人 ...原创 2018-03-14 20:35:58 · 1041 阅读 · 0 评论 -
第三章部分习题
3-1names = ["321","456","789"]print (names)for i in names: print(i)3-5names = ["321","456","789"]no = names.pop();print(no + "cant come")names.append("110")print(names)for i in原创 2018-03-08 16:28:58 · 234 阅读 · 0 评论 -
第四章部分习题
4-1pizza = ["a","b","c"]for i in pizza: print("i like " + i +" pizza")print("i really love pizza")4-3number=[]for i in range(1,1000001): number.append(i);print(min(number))print(max(number))print(原创 2018-03-08 16:53:37 · 641 阅读 · 0 评论 -
第五章部分习题
5-2str1 = " mary"str2 =" Mary"print(str1 == str2)print(str1.lower() == str2.lower())name = list(range(1,11))if 2 in name: print("hhhhhh")if 33 not in name: print("gggggg") 5-5color = "red"...原创 2018-03-08 17:27:23 · 329 阅读 · 0 评论 -
第六章部分习题
6-1man = {'finame' : "a",'laname' : "b",'age' : 11 , 'city' : "c"}print(man)6-5rivers = { 'nile': 'egypt', 'mississippi': 'united states', 'fraser': 'canada', 'kuskokwim': 'alaska', ...原创 2018-03-08 18:54:29 · 382 阅读 · 0 评论 -
第十四章 【pygame】增加积分系统,增加PLAY按钮,增加难度系统
这里的内容早早就弄完了,后来一直在弄pyinstaller打包成exe一直都失败,所以一直没更新。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。这章完成三个功能:1:难度系统,根据消灭的怪物的波数更改游戏的难度,为了简单起见,难度增加直接体现在外星人的行数和移动速度的增加,在实现的过程中,只需要增加一个hard参数,传递到外星人类里面,在设置行数和移动速...原创 2018-03-15 17:49:00 · 3536 阅读 · 4 评论 -
第七章部分习题
7-3number = input()number = int(number)number= number%10;if not number : print("Yes")else : print("No")7-5while True: age = input() if age == 'quit': break age = int(age) if age <...原创 2018-03-09 13:48:34 · 462 阅读 · 0 评论 -
第十二章 【pygame】 做一架能射子弹的小飞船
基本上是按照课本给的路线和代码。一:安装pip:点击打开链接 点击里面的getpip.py。则出来get-pip.py的代码在浏览器里面,复制代码到编辑器中运行则pip安装完成。二:安装pygame:点击打开链接 找到pygame一系列 我的电脑是win10 64位 则下载 pygame-1.9.3-cp36-cp36m-win_amd64.whl 下载到项目文件夹中 运行cmd ...原创 2018-03-13 11:35:33 · 1927 阅读 · 8 评论 -
第十一章部分作业
11-1def city_country(city, country): return(city.title() + ", " + country.title())import unittestclass CitiesTestCase(unittest.TestCase): def test_city_country(self): """Does a simple cit...原创 2018-04-09 14:05:06 · 1231 阅读 · 0 评论