- 博客(21)
- 收藏
- 关注
原创 Python编程作业【第十五周】(sklearn homework)
SklearnCreate a classification dataset (n samples ≥≥\geq 1000, n features ≥≥\geq 10)Split the dataset using 10-fold cross validationTrain the algorithmsEvaluate the cross-validated performance I...
2018-06-20 22:57:03 324
原创 Python编程作业【第十四周】(jupyter homework)
Anscombe’s quartetAnscombe’s quartet comprises of four datasets, and is rather famous. Why? You’ll find out in this exercise.%matplotlib inlineimport randomimport numpy as npimport scipy as...
2018-06-13 00:29:25 360
原创 Python编程作业【第十三周】(scipy homework)
ScipyExercise 10.1: Least squaresimport numpy as npfrom scipy import linalgimport matplotlib.pyplot as pltimport mathm = 201n = 200A = np.random.randint(1, 10, (m, n))b = np.random.ran...
2018-05-31 18:44:57 357 1
原创 Python编程作业【第十一周】(Matplotlib homework)
Matplotlib ExerciseExercise 11.1: Plotting a functionimport numpy as npimport matplotlib.pyplot as pltimport mathx = np.linspace(-1, 3, 500)y = np.power(np.sin(x - 2), 2) * np.power(np.e...
2018-05-26 15:01:02 394
原创 Python编程作业【第十一周】(Numpy homework)
NumpyExercise 9.1: Matrix operationsimport numpyfrom scipy import linalgn = 200m = 500def function(lam, A, B): lam = int(lam) I = numpy.eye(m) B_minus_lambdaI = B - lam * I ...
2018-05-22 23:27:31 258
原创 Python编程作业【第九周】(一)
#120 Triangle题目来源https://leetcode.com/problems/triangle/description/题意分析在一个二维列表当中存储着一个三角形形状的数据,当这些数据被看成是三角形形状时,求出从上到下(或从下到上)的和的最小值。[ [2], [3,4], [6,5,7],[4,1,8,3]]解题思路这道题和上一...
2018-05-07 00:02:57 812
原创 Python编程作业【第八周】(三)
LEETCODE#53 Maximum SubarrayDescription: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.这个问题要解决的...
2018-04-29 23:22:20 232
原创 Python编程作业【第八周】(二)
LEETCODE#27 Remove ElementDescription: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for anoth...
2018-04-29 22:41:45 211
原创 Python编程作业【第八周】(一)
LEETCODE#26 Remove Duplicates from Sorted ArrayDescription: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. D...
2018-04-29 22:02:37 399
原创 Python编程作业【第六周】(二)
11-1 cities and countriesdef get_city(city, country): city_country = city + ", " + country return city_country.title()import unittestfrom func import get_cityclass NameTestCase(unittest.Tes...
2018-04-15 11:09:19 222
原创 Python编程作业【第六周】(一)
10-9 silent cat and dogtry: with open("cats.txt") as obj: for line in obj.readlines(): print(line, end = '') with open("dogs.txt") as obj: for line in obj.readlines(): print(li...
2018-04-15 09:46:45 253
原创 Python编程作业【第五周】(二)
10-1 Python notesfile_path = "learning_python.txt"with open(file_path) as obj: str1 = obj.read()print(str1)with open(file_path) as obj: for line in obj.readlines(): print (line)wit...
2018-04-07 13:59:18 639
原创 Python编程作业【第五周】(一)
9-1 restaurantsclass Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_resta...
2018-04-07 11:42:24 494
原创 Python编程作业【第四周】(二)
8-1 messagesdef display_message(): print("nice to learn the method")display_message()8-2 favorite booksdef favorite_book(title): print("One of my favorite books is Alice in Wonderland")favor...
2018-03-29 18:12:47 369
原创 Python编程作业【第四周】(一)
7-1 rent a carcar = input("What kind of car do you want to rent?")print("Let me see if I can find you a Subaru")7-2 order tablepeople_number = int(input("How many people will have dinner here?"))if ...
2018-03-27 00:11:56 408
原创 Python编程作业【第三周】(二)
6-1 nameszhaobq = {"name": "zbq", "age": 20, "sex": "male"}6-2 favourite numbersfavourite_nums = {"zbq": 7, "zj": 5, "zzr": 6, "lxr": 1, "zzy": 4}for key,
2018-03-22 23:50:58 210
原创 Python编程作业【第三周】(一)
5-1 namescar = 'BMW'print (car == 'BMW')print (car == 'Audi')5-2 greet wordscar1 = 'BMW'car2 = 'Bmw'print (car1 == car2.upper())print (3 > 2)print (car1 == car2 and car1 == car2.upper())cars = ['BM...
2018-03-22 21:39:41 556
原创 Python编程作业【第二周】(二)
4-1 pizzapizzas = ["humbuger", "pizza", "pie"]for pizza in pizzas: print (pizza)for pizza in pizzas: print (pizza, ", I want to eat you˜")print ("I really love pizza!")4-2 animalsanimals = ...
2018-03-17 11:35:43 311
原创 Python编程作业【第二周】(一)
3-1 namesnames = ['zhaobinqi', 'zhuzhiru', 'zongjie']for name in names: print (name)3-2 greet wordsnames = ['zhaobinqi', 'zhuzhiru', 'zongjie']for name in names: print (name.title() + ', nic...
2018-03-12 23:15:42 326
原创 Python编程作业【第一周】(二)
TALK IS CHEAP, I WILL SHOW YOU MY CODE.2-1 simple messagea = "Hello python world!!!!"print (a)2-2 two simple messagesa = "Hello python world!!!!"print (a)a = "Nothing is really beautiful but truth"...
2018-03-11 10:12:15 352
原创 Python编程作业【第一周】(一)
1-1 python官网:python.org在第一节课上,老师对python这门语言做了简要的介绍,让我这个python的初学者对python有了大致的了解,其中python的官网也对我起到了很大的帮助。1、python官网的风格可以说是非常的简洁明了,设计风格也非常的美观。官网主页上贴出不同类型的选项:关于python、下载、文件、社区。滑动滚轮,继续浏览网页可以发现python的发展过程和升...
2018-03-10 10:58:51 1572
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人