课程:高级编程技术
文章平均质量分 75
PerfectCherryBlossom
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
3.14作业
4-2 动物animals = {"pig", "chicken", "beef cattle"}for animal in animals: print("A " + animal + " can be cooked into a great dish.")print("Any of these animals would make up of a great dish.")4-5原创 2018-03-15 14:37:10 · 234 阅读 · 0 评论 -
6.6作业(pandas练习)
题目来源题目给了一个 csv 文件,读入文件得到一个 DataFrame 对象,该对象中有4个数据集,要对这4个数据集做一些操作。如果不熟悉 python pandas,可以参考 pandas 入门教程Exercise 1题意题解用布尔索引的方式划分数据集,对每个数据集调用相应的函数求解。求线性回归的API是OLS类。endog 参数是因变量, exog 参数是自变量。要先用 add_consta...原创 2018-06-10 14:47:58 · 866 阅读 · 0 评论 -
5.23作业(matplotlib练习)
Exercise 1: Plotting a function题意题解numpy.linspace 生成一段区间内均匀分布的点。用这个函数生成横坐标。numpy 提供了很多数学函数,这里能用到的有 numpy.sin, numpy.power, numpy.exp, numpy.negative。matplotlib.pyplot 提供了绘制图像的函数 plot,也提供了设置横坐标名、纵坐标名、标...原创 2018-05-29 00:13:16 · 541 阅读 · 0 评论 -
5.30作业(scipy练习)
Exercise 1: Least squares题意题解要求出最小二乘解 x 和残差的范数,用 scipy.linalg.lstsq 函数。from numpy import randomfrom scipy import linalgm = 30n = 20A = random.randn(m, n)b = random.randn(m, 1)x, residual, rank...原创 2018-06-03 13:53:13 · 541 阅读 · 0 评论 -
5.16作业(numpy练习)
Exercise 0题意题解randn(d0, d1, ..., dn) 返回一个n维数组,数组是标准正态分布的样本。用randn函数得到二维数组A。import numpyfrom numpy import randomn = 200m = 500A = random.randn(n, m)numpy库中没有toeplitz函数,scipy.linalg库有。其实可以自己写一个函数生成...原创 2018-05-21 01:15:35 · 484 阅读 · 0 评论 -
4.4作业
10-4 访客名单file_name = "test.out.txt"with open(file_name, 'w') as file: while True: user_name = input("Please enter your name(enter \'q\' to quit): ") if user_name == 'q': br...原创 2018-04-05 16:22:43 · 232 阅读 · 0 评论 -
3.28作业
8-4 大号T恤def make_shirt(size = "large", words = "I love Python"): print("A " + size + " T-shirt with \"" + words + "\"")make_shirt()make_shirt(size = "medium")make_shirt(words = "原创 2018-03-29 11:50:18 · 388 阅读 · 0 评论 -
4.2作业
9-1 餐馆class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restauran...原创 2018-04-04 12:21:21 · 359 阅读 · 0 评论 -
4.9作业
11-1 城市和国家# city.pydef get_formatted_city(city, country): message = city.title() message += ", " message += country.title() return message# test_city.pyimport unittestfrom city import ...原创 2018-04-10 12:03:55 · 272 阅读 · 0 评论 -
3.26作业
7-3 10的整数倍number = int(input("Please enter a number: "))if number % 10 == 0: print(str(number) + " is a multiple of 10.")else: print(str(number) + " is not a multiple of 10.")7-4 披萨配料print("Plea...原创 2018-03-26 22:11:52 · 305 阅读 · 0 评论 -
3.21作业
6-6 调查favorite_language = { 'jen' : 'Python', 'sarah' : 'c', 'edward' : 'ruby', 'phil' : 'python', 'bill' : 'cpp'}people_to_be_polled = ('edward', 'phil', 'steve', 'harry')for person in...原创 2018-03-22 00:01:28 · 283 阅读 · 0 评论 -
3.19作业
5-5 外星人颜色#3def print_score(alien_color): pre = "You've got " post = " scores!" if alien_color == "green": print(pre + "5" + post) elif alien_color == "yellow": print(pre + "1.原创 2018-03-19 23:54:27 · 283 阅读 · 0 评论 -
3.12作业
3-4 嘉宾名单people = ["first person", "second person", "third person"]for person in people: print(person.title() + ", would you like to have dinner with me?")3-5 修改嘉宾名单def invite(people): for person...原创 2018-03-12 13:18:32 · 291 阅读 · 0 评论 -
3.7作业
2-1 简单消息message = "this is a message"print(message)2-2 多条简单消息message = "this is the first message"print(message)message = "this is the second message"print(message)2-3 个性化消息name = "Eric Matthes"print(...原创 2018-03-11 14:08:49 · 267 阅读 · 0 评论 -
3.5作业
一、浏览python主页,写下发现和收获 python主页:https://www.python.org 主页是这样形容python的: Python is powerful... and fast; plays well with others; runs everywhere; is friendly & easy to learn; ...原创 2018-03-11 12:11:59 · 289 阅读 · 0 评论 -
6.13作业(sklearn练习)
题目Step 1:sklearn.datasets.make_classification 函数能随机产生 n_classes 类数据集,返回一组样本(sample)和一组标记(label)。from sklearn import datasetsfrom sklearn import model_selectionfrom sklearn import naive_bayesfrom sk...原创 2018-06-18 17:48:50 · 410 阅读 · 0 评论
分享