![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Homework
GeassTaiga
这个作者很懒,什么都没留下…
展开
-
[Course] Advanced Computer Programming, Homework, week 2
Chapter 3Chapter 4Chapter 3# 3-1 姓名names = ['Tom', 'Jerry', 'Jack']for name in names: print(name, end=', ')Tom, Jerry, Jack, # 3-6 添加嘉宾persons = ['Tom', 'Jerry', 'Jack']per...原创 2018-03-15 21:03:05 · 219 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 14, Jupyter Notebook
Jupyter Notebook Exercises%matplotlib inlineimport randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport statsmodels.api a...原创 2018-06-12 20:51:21 · 264 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 13, SciPy
10.1 Least squaresimport numpy as np import matplotlib.pyplot as pltfrom scipy.linalg import *m = 20n = 15A = np.random.random((m, n))b = np.random.random((m,))cc, re, rank, sigma = lstsq...原创 2018-06-05 19:45:33 · 234 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 12, Matplotlib
在jupyter notebook中书写,%matplotlib inline 可使图片直接显示%matplotlib inlineimport matplotlib.pyplot as pltimport numpy as np1.11 Plotting a functionPlot the function f(x)=sin2(x−2)e−x2f(x)=sin2(x−2)e...原创 2018-05-29 11:03:48 · 198 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 12, NumPy
Some NumPy ExercisesSome NumPy Exercises9.1 Matrix operations9.2 Solving a linear system9.3 Norms9.4 Power iteration9.5 Singular values9.6 Nearest neighborGenerate matrices A, with r...原创 2018-05-22 18:48:29 · 273 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 9-1, LeetCode 148. Sort List
148. Sort List题目来源https://leetcode.com/problems/sort-list/description/题意分析对链表进行排序,要求复杂度为 O(NlogN)O(NlogN)O(NlogN)题目思路采用归并排序,与数组的归并排序在划分和合并时略有不同代码class Solution: def sortLis...原创 2018-04-29 22:24:02 · 140 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 8-2, LeetCode 134. Gas Station
134. Gas Station题目来源https://leetcode.com/problems/gas-station/description/题意分析给定一个圈,可以从圈的任何一个位置开始,在位置i可以获得gas[i]的能量,从i到位置i+1需要消耗cost[i]的能量,若能够按顺时针走一圈,输出初始位置,否则输出-1(若有解,保证解是唯一的)题目...原创 2018-04-28 23:38:10 · 199 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 8-1, LeetCode 120. Triangle
120. Triangle题目来源https://leetcode.com/problems/triangle/description/题意分析给定一个三角形矩阵,找到从上到下的最短路,每一步只能走下一行的邻接的两个数题目思路这是一道非常基础的DP,采用动态规划的思想,从下往上处理,有triangle[i][j] += min(triangle[i+1]...原创 2018-04-28 22:19:04 · 157 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 9-2, LeetCode 215. Kth Largest Element
215. Kth Largest Element in an Array题目来源https://leetcode.com/problems/kth-largest-element-in-an-array/description/题意分析找出序列中第k大元素题目思路用快速选择算法求解,即随机选择数组中的一个数,进行划分,若划分的这个数恰好是第k大,那么返回结果。若...原创 2018-05-02 21:50:21 · 194 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 4
Chapter 7Chapter 8Chapter 7# 7-1 汽车租赁car = input("Which type of car do you like? ")print("\nLet me see if I can find you a", car)Which type of car do you like? red carLet me see if I c...原创 2018-03-28 22:36:25 · 209 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 6
# 11-1 城市和国家import unittestdef city_functions(city, country): return city.title() + ', ' + country.title()class NamesTestCase(unittest.TestCase): def test_city_country(self): name ...原创 2018-04-14 20:39:18 · 125 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 3
Chapter 5Chapter 6Chapter 5# 5-1 条件测试for i in range(10): print(i%2==0)TrueFalseTrueFalseTrueFalseTrueFalseTrueFalse# 外星人颜色#1alien_color = 'green'if alien_color == '...原创 2018-03-21 21:47:14 · 134 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 5
Chapter 9Chapter 10Chapter 9# 9-1 餐馆class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = ...原创 2018-04-08 10:01:47 · 196 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 1
Advanced Computer Programming, Homework, week 1Advanced Computer Programming, Homework, week 11.浏览Python主页(https://www.python.org/),在博客上写下你有哪些发现和收获2.假设你已经成为一名Python编程高手,你打算实现怎样的程序?在博客上写下你的目标3.教...原创 2018-03-10 00:44:17 · 244 阅读 · 0 评论 -
[Course] Advanced Computer Programming, Homework, week 15, scikit-learn
scikit-learn exampleimport numpy as npfrom sklearn import metricsfrom sklearn import datasetsfrom sklearn.model_selection import cross_validatefrom sklearn.naive_bayes import GaussianNBfrom s...原创 2018-06-18 14:04:50 · 253 阅读 · 0 评论