- 博客(20)
- 收藏
- 关注
原创 week15
Assignment from sklearn import datasets from sklearn.naive_bayes import GaussianNB from sklearn import cross_validation from sklearn.svm import SVC from sklearn import metrics # 生成数据集 data = datas...
2018-06-16 02:04:37
240
原创 week14
Part I For each of the four datasets… %matplotlib inline import random import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import sta...
2018-06-09 00:22:39
339
原创 第十三周作业
Exercise 10.1: Least squares Exercise 10.2: Optimization Exercise 10.3: Pairwise distances Exercise 10.1: Least squares find x=argmin||Ax−b||x=argmin||Ax−b||x=argmin||Ax-b|| 代码 import nump...
2018-05-30 23:10:24
259
原创 第12周作业
Plotting a function Data Histogram and density estimation Plotting a function 写函数画图即可 代码 import matplotlib.pyplot as plt import numpy x = numpy.linspace(0, 2, 100); y = pow((numpy.sin(x-...
2018-05-25 15:47:32
224
原创 第11周-Python-hw
Exercise 9.1: Matrix operations Generate matrices AAA, with random Gaussian entries, BBB, a Toeplitz matrix, where A∈Rn×mA∈Rn×mA \in R^{n \times m} and B∈Rm×mB∈Rm×mB \in R^{m \times m}, for n = 200, ...
2018-05-18 19:32:36
545
原创 第九周-Python-leetcode-hw2
题目 283. Move Zeroes 解题思路 代码 题目 283. Move Zeroes Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For ...
2018-05-06 13:38:34
157
原创 第九周-Python-leetcode-hw1
题目 167. Two Sum II - Input array is sorted 思路 代码 题目 167. Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascending order, find two numbers such t...
2018-05-06 13:31:08
223
原创 第八周-Python-leetcode-hw2
题目 485. Max Consecutive Ones 解题思路 代码 题目 485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. 解题思路 遍历整个数组,用t计算连续的1的个数。如果遇到1,t加1;如果遇到...
2018-04-25 20:36:07
162
原创 第8周-Python-leetcode-hw1
题目 26. Remove Duplicates from Sorted Array 解题思路 代码 题目 26. Remove Duplicates from Sorted Array Given a sorted array nums, remove the duplicates in-place such that each element appear onl...
2018-04-25 20:31:17
195
原创 第六周-Python-hw
11-1 城市和国家 11-2 人口数量 11-3 雇员 11-1 城市和国家 代码 #city_functions def city_country(city, country): return city.title() + ", " + country.title(); #test_cities.py import unittest from city_...
2018-04-16 06:57:42
388
原创 第五周-python-hw2
10-1 Python学习笔记 10-3 访客 10-7 加法计算器 10-1 Python学习笔记 代码 #读取整个文件打印 with open('learning_python.txt') as file_object: contents=file_object.read() print(contents) #遍历文件对象打印 with open('...
2018-04-07 14:35:53
252
原创 第五周-python-hw1
作业 9-1 餐馆 9-6 冰淇淋小店 9-10 导入Restaurant类 9-14 骰子 作业 9-1 餐馆 创建一个名为Restaurant的类,包括restaurant_name和cuisine_type属性,describe_restaurant()和open_restaurant()方法 代码 class Restaurant(): """...
2018-04-07 14:01:13
252
原创 第四周-python-hw2
作业 8-1 消息 8-3 T恤 8-9 魔术师 作业 8-1 消息 编写一个打印一条信息的函数 代码 def display_messages(): print("I learned something about function calls in this chapter.") display_messages(); 输出 I learne...
2018-03-28 19:06:46
201
原创 第四周-python-hw1
作业 7-1 汽车租赁 7-2 餐馆订位 7-3 10的整数倍 7-8 熟食店 作业 7-1 汽车租赁 询问用户要什么样的汽车,并打印信息 代码 car=input("What kind of cars do you want to rent?\n") print("Let me see if I can find you a " + car) 输出 Wh...
2018-03-28 18:58:22
178
原创 第三周-python-hw2
作业 6-1 使用一个字典来存储一个熟人的信息 6-2 存储数字 6-6 修改6.3.1的程序 6-10 修改6-2的代码,使得一个人可以有多个喜欢的数字 作业 6-1 使用一个字典来存储一个熟人的信息 包括名、姓、年龄和居住的城市,将所有信息输出 在做这一题的时候犯的一些错误: 1. 这里的键应该是字符串类型,但是我忘了加引号,所以解释器报错说没有这个变量 ...
2018-03-23 20:29:16
306
原创 第三周-python-hw1
反思 作业 5-1 编写一系列条件测试,将预测和结果打印出来 5-3 检查外星人颜色是否为绿色 5-8 以特殊方式和管理员打招呼 5-9 处理没有用户的情形 反思 再看上周的作业,看起来欠缺不少。需继续努力学习怎么写一篇好看的博客。 作业 5-1 编写一系列条件测试,将预测和结果打印出来 代码 color='white' print ("Is color =...
2018-03-19 17:42:13
282
原创 第二周-python-hw2
反思 作业 4-3 使用for循环打印数字1~20(含20) 4-4 输出整数1到1000 000 4-6 输出 [1,21] 中的奇数 打印 [3,30] 中3的倍数 4-9 用列表解析生成前10个整数的立方 反思 再看上次的作业,比第一周的作业好了一些。但是相比起我看过的其他的博客来说,还是很难看。我觉得这不仅仅是Markdown运用熟练程度的问题,更重要的是审...
2018-03-14 19:52:04
320
原创 第二周-python-hw1
上次作业反思: 本章作业 3-1 将一些朋友的名字存储在一个列表中并依次输出 3-2 为3-1中的人每人打印一条相同的问候语 3-5 修改3-4的嘉宾名单 3-9 指出3-4~3-7中邀请的嘉宾人数 上次作业反思: 再次查看上周的作业,发现上周的作业真的很丑,丑到甚至自己都不想看。我认为这样不能起到“促进反思”的作用,然后了解到优快云支持Markdown排版,...
2018-03-12 16:57:38
256
原创 20180308-python_hw2
说明:按网上的教程配置好Sublime Text 3,http://blog.youkuaiyun.com/u011475210/article/details/78168341 按照教程配置,F4切换至python解释器,F5直接执行当前python脚本。本次作业全用Sublime Text 3编写好程序后,F5执行程序出结果.2-12-22-32-42-52-62-72-82-92-102-11...
2018-03-08 00:26:59
244
原创 20180305-python-hw1
1.官网上的资源非常丰富。 除了提供python下载和说明文档,还有社区和新手帮助手册。这些都是python能拥有今天这样广泛的影响力的重要因素。 作为一名新手,我认为说明文档非常有效,几乎任何问题都能从上面找到答案,因此多多阅读说明文档非常有益于提高python编程能力。庞大的社区蕴含丰富的资源,相互交流学习也是提高的有效方式。2.写个高效、好用的爬虫,界面友好。只要输入关键词,能快速收集数...
2018-03-05 13:27:31
792
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅