- 博客(21)
- 收藏
- 关注
原创 【python】第二十三次课作业
作业题目:源代码:from sklearn import datasets from sklearn import cross_validationfrom sklearn import metrics# creat datasetdataset = datasets.make_classification(n_samples = 1000, n_features = 10, n_inf...
2018-06-19 21:45:11
264
原创 【python】第二十二次课作业
本次作业的网站来源:作业地址题目:1.源代码data_stats = {}for i in range(0, 4): data = anscombe[anscombe.data == i] cur_data_stats = {} cur_data_stats['average'] = np.average(data.x) cur_data_stats['varia...
2018-06-10 09:53:13
208
原创 【python】第二十一次课作业
exercisesScripy10.1题目源代码import numpy as npimport scipy.linalg as slm = int(input("Please input m: "))n = int(input("Please input n: "))if n > m: t = m m = n n = tA = np.rando...
2018-06-03 18:15:28
174
原创 【python】第二十次课作业
exercisesmatplotlib11.1题目:源代码:<span style="font-size:16px;">import numpy as np</span><span style="font-size:16px;">import matplotlib.pyplot as plt</span><span style="
2018-05-28 17:41:06
241
原创 【python】第十九次课作业
exercisesNumpyexercises 9.1题目:源代码:from numpy import *import numpy as npdef fun(A, B, v, I): print("A + A = ") C = A + A print(C) print("AAT = ") D = A * A.T print(D) print("ATA = ") E =...
2018-05-21 19:40:45
188
原创 【python】第十八次课作业
这次选取的题是leetcode的array下209. Minimum Size Subarray Sum(原题链接)题目如下:源代码:class Solution(object): #() def minSubArrayLen(self, s, nums): start = 0 sum = 0 min_size = float("in...
2018-05-11 18:23:47
183
原创 【python】第十七次课作业
这次在leetcode上选取的是array里面的74. Search a 2D Matrix(原题链接),题目如下:源码如下:class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type targe...
2018-04-29 18:06:34
233
原创 【python】第十六次课作业
本次选取了leetcode上另一道题目41. First Missing Positive(原题链接)。题目如下:源码如下:class Solution(object): def firstMissingPositive(self, nums): if nums != []: for i in range(1, 1000): ...
2018-04-27 18:02:53
149
原创 【python】第十五次课作业
在leetcode上选择一道题完成。我选的是array下的4. Median of Two Sorted Arrays这道题(原题链接)。题目如下:源码如下:class Solution(object): def findMedianSortedArrays(self, nums1, nums2): for i in range(0, len(nums2)): ...
2018-04-27 17:21:16
349
原创 【python】第十一次课作业
11-1city_functions.pydef cityFun(city, country): return city + ", " + countrytest_cities.pyimport unittestfrom city_functions import cityFunclass CityTestCase(unittest.TestCase): def test_city_co...
2018-04-09 23:23:20
304
原创 【python】第十次课作业
10-1 10-2filename = 'learning_python.txt'with open(filename) as file_object: lines = file_object.read() print(lines)print('')with open(filename) as file_object: for line in file_object: prin...
2018-04-05 11:56:36
194
原创 【python】第九次课作业
9-1 9-2class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print(se...
2018-04-05 10:07:45
206
原创 【python】第八次课作业
8-3 8-4def make_shirt(size = 'XXL', pic = 'I love Python'): print("Your shirt is " + size + ", with picture '" + pic + "'.")make_shirt('M', 'COOL')make_shirt(pic = 'My T', size = 'S')make_shirt()...
2018-03-31 17:20:39
380
原创 【python】第七次课作业
7-2num = int(input("How many people did you invite?"))if num <= 8: print("There are tables available.")else: print("There are no tables available.")7-4while 1: food = input("Input name of the ...
2018-03-29 10:42:55
264
原创 【python】第六次课作业
6-1 6-4myfriend = {'first_name': 'niok', 'last_name': 'yhg', 'age': 18, 'city':'xian'}print(myfriend)print('\n')for key, value in myfriend.items(): print(key + ":") print(value) print('\n')6-6n...
2018-03-22 11:25:14
261
原创 【python】第五次课作业
5-2car = 'Subaru'print("Is car == Subaru?")print(car == 'Subaru')print("Is car == Audi?")print(car == 'Audi')print("Is car == subaru?")print(car == car.lower())num = 7print("Is 3 < 7 < 1...
2018-03-22 10:54:36
341
原创 【python】第四次课作业
4-1pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']for pizza in pizzas: print(pizza)for pizza in pizzas: print("I like "+pizza+"pizza.")print("I really love pizza!")4-3~4-9for i in range(1, 4): print(i)...
2018-03-14 23:31:46
196
原创 【python】第四次课作业
4-1pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']for pizza in pizzas: print(pizza)for pizza in pizzas: print("I like "+pizza+"pizza.")print("I really love pizza!")4-3~4-9for i in range(1, 4): print(i)...
2018-03-14 23:12:49
244
原创 【python】第三次课作业
3-1~3-3names = ['Karry', 'Roy', 'Jackson']print(names)print(names[0]+", nice to meet you!")print(names[1]+", nice to meet you!")print(names[2]+", nice to meet you!")3-4~3-7names = ['Karry', 'Roy',...
2018-03-14 22:47:48
275
原创 【python】第二次课作业
name = "Karroy Wang"print(name.title())print(name.lower())print(name.upper())hi = "Hello " + name + "."print(hi)print("Welcome to learn Python!")name = " Karroy Wang "print(name)print(name.r...
2018-03-11 14:45:58
212
原创 【python】第一次课作业
一 早就听说过python的大名,浏览过python的主页后,发现对于这门语言的特性的描述无处不在。Python讲求"用一种方法,最好只有一种方法解决一个问题。"这是在以前学习其他的编程语言时从没有提到过的。在C/C++里,一个问题往往有许多种解法,而python因为贯彻了这一原则,使得这门语言非常简洁,便于理解和交流,这就是他的强大之处。 Python目前是最主流的编程语言之一...
2018-03-08 08:29:12
380
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人