- 博客(20)
- 收藏
- 关注
原创 python Datasets 作业
题目描述:代码:from sklearn import cross_validationfrom sklearn import datasets#step1d, t = datasets.make_classification(n_samples=1000, n_features=10, n_informative=2, n_redundant=2, n_repeated=0, n_cla...
2018-06-20 20:59:15
1326
原创 python Anscombe' quartet 作业
描述https://github.com/schmit/cme193-ipython-notebooks-lecture/blob/master/Exercises.ipynb代码:import randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimpo...
2018-06-10 16:38:18
362
原创 python scipy作业
代码:from scipy.optimize import leastsqfrom scipy.optimize import fsolvefrom scipy.optimize import minimize_scalarfrom scipy.spatial import distanceimport scipy.optimize as optimport numpy as np#...
2018-06-02 16:34:14
459
原创 python matplotlib作业
代码:import matplotlib as mptimport pylabimport mathimport numpy as npfrom scipy.optimize import leastsqfrom scipy import stats#11.1 Plotting a functionx = np.linspace(0, 2, 1000)y = np.sin((x-...
2018-05-27 22:38:25
281
原创 python numpy作业
代码:import numpyimport timefrom scipy import linalgn = 200m = 500A = numpy.random.normal(size = (n, m))f = numpy.random.randint(1, 1000, size = m)B = linalg.toeplitz(f)#9.1#A+AA_A = A + A'...
2018-05-19 23:41:54
321
原创 python leetcode编程作业4
题目:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Could you do it without extra s...
2018-05-09 15:50:52
152
原创 python leetcode编程作业3
题目:Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3.Note:Your algorithm sh...
2018-05-01 02:33:39
122
原创 python leetcode编程作业2
题目:3SumGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not c...
2018-05-01 02:02:29
140
原创 python leetcode编程作业1
题目:TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], ...
2018-04-30 19:54:58
177
原创 高级编程技术课后作业 第十一章练习
11-1 城市和国家代码:import unittestdef get_city_country(city, country): return city + ", " + countryclass place(unittest.TestCase): def test_get_city_country(self): str = get_city_country(...
2018-04-14 10:45:38
261
原创 高级编程技术课后作业 第十章练习
10-1 python学习笔记代码:with open('input.txt') as input: print(input.read())with open('input.txt') as input: file_in = input print(file_in.read())list = []with open('input.txt') as input:...
2018-04-06 17:26:02
183
原创 高级编程技术课后作业 第九章练习
9-1 餐馆代码:class Restaurant(): def __init__(self, name, type): self.restaurant_name = name self.cuisine_type = type def describe_restaurant(self): print("name:" + self.r...
2018-04-06 16:06:21
163
原创 高级编程技术课后作业 第八章练习
8-2 喜欢的图书代码:def favorite_book(book): print("One of my favorite books is " + book)favorite_book("《灿烂千阳》")结果:One of my favorite books is 《灿烂千阳》8-4 大号t恤代码:def make_shirt(message="I love python", s...
2018-04-01 20:38:48
144
原创 高级编程技术课后作业 第七章练习
7-3 10的整数倍代码:num = int(input("请输入一个数字:"))if num % 10 == 0: print("这个数字是10的整数倍")else: print("这个数字不是10的整数倍")结果:请输入一个数字:100这个数字是10的整数倍请输入一个数字:99这个数字不是10的整数倍7-5 电影票代码:message = ""while True: ...
2018-04-01 19:36:39
171
原创 高级编程技术课后作业 第六章练习
6-2 喜欢的数字代码:favorite_num = {"Amy": 1, "John": 2, "Lily": 2, "Mike": 5, "Tom": 3}for name, num in favorite_num.items(): print(name + " is fond of " + str(num))结果:Amy is fond of 1John is fond
2018-03-25 14:41:56
157
原创 高级编程技术课后作业 第五章练习
5-2 更多的条件测试代码:print("abc" == "abc")print("aaa" == "bbb")print("ABC"=="abc")print("ABC".lower()=="abc")print(1 > 2 and 2 > 1)print(1 >2 or 2 > 1
2018-03-25 14:23:45
238
原创 高级编程技术课后作业 第四章练习
4-2 动物代码:animals = ['dog', 'cat', 'squirrel']for animal in animals: print("A " + animal + " would make a great pet.")print("Any of these animals would make a great pet!")结果:A dog would make a gr...
2018-03-18 09:53:46
307
原创 高级编程技术课后作业 第三章练习
3-2 问候语代码:names = ["Amy", "John", "Mike"]for name in names: print("Hi, " + name + "!")结果:Hi, Amy!Hi, John!Hi, Mike!3-6 添加嘉宾代码:names = ["Amy", "John", "Mike"]names.insert(0,
2018-03-18 09:24:29
247
原创 高级编程技术课后作业 第二章练习
第二章练习2-2 多条简单消息>>> str = "Hello">>> print(str)Hello>>> str = "Hi">>> print(str)Hi2-4调整名字大小写>>> name = "MiKe">&
2018-03-11 16:09:17
176
原创 高级编程技术课后作业0
1.浏览python主页,在博客上写下你有哪些发现和收获 我在浏览python主页后,看出python主页除了提供python各个版本的下载以外,主要是在宣传python编程语言的各个优点,还分享了许多人使用python而成功的故事。可见,python这门语言的成功除了本身的优点以外,离不开人们的大力宣传。2.假如你已经成为了一位python编程高手,你打算实现怎样的程序?在博客上写下你的目...
2018-03-11 10:25:32
168
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人