自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 W15 作业

from sklearn import datasets from sklearn import cross_validation from sklearn.naive_bayes import GaussianNB from sklearn import metrics from sklearn.svm import SVC from sklearn.ensemble import Random...

2018-06-24 12:02:45 276

原创 W14 作业

import random import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm import statsmodels.formula.api as smf sns.se...

2018-06-24 11:55:43 220

原创 W13 作业

10.1import numpy as np m = 20 n = 10 a = np.random.randn(m,n) b = np.random.randn(m) x = np.linalg.lstsq(a,b) print(x)10.2import numpy as np from scipy import optimize as op def f(x): return np.mult...

2018-06-10 16:15:29 187

原创 W12 作业

import matplotlib.pyplot as plt import numpy as np a = np.linspace(0,2,1000) b = np.multiply(np.power(np.sin(a-2),2),np.exp(-np.power(a,2))) plt.plot(a,b,label='$sin^2(a-2)*e^(-a^2)$') plt.xlim((-0.5,...

2018-05-30 13:02:16 165

原创 W11 作业

9.1import numpy as np from scipy.linalg import toeplitz def caculate_with_k(A,B,m,k): I = np.eye(m,m,0) return np.dot(A,B-k*I) n = 200 m = 500 k = np.random.randn() A = np.random.randn(n,m) B = toep...

2018-05-22 13:59:23 171

原创 W9-C2 作业

题号:491题目要求:两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目。给出两个整数 x 和 y,计算它们之间的汉明距离。注意:0 ≤ x, y < 231.示例:输入: x = 1, y = 4 输出: 2 解释: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ 上面的箭头指出了对应二进制位不同的位置。 代码:class Solut...

2018-05-06 09:06:53 269

原创 W8-C3(5.1串休) 作业

题号:804题目要求:国际摩尔斯密码定义一种标准编码方式,将每个字母对应于一个由一系列点和短线组成的字符串, 比如: "a" 对应 ".-", "b" 对应 "-...", "c" 对应 "-.-.", 等等。为了方便,所有26个英文字母对应摩尔斯密码表如下:[".-","-...","-.-.","-..",

2018-04-29 18:32:00 483

原创 W8-C2 作业

leetcode竟然有中文版!题号:476题目要求:给定一个正整数,输出它的补数。补数是对该数的二进制表示取反。注意:给定的整数保证在32位带符号整数的范围内。你可以假定二进制数不包含前导零位。示例 1:输入: 5 输出: 2 解释: 5的二进制表示为101(没有前导零位),其补数为010。所以你需要输出2。 示例 2:输入: 1 输出: 0 解释: 1的二进制表示为1(没有前导零位),其补数为0...

2018-04-29 17:58:48 284

原创 W8-C1 作业

题号:1题目要求:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use th...

2018-04-29 16:50:25 182

原创 W6-C1 作业

11-1def printnames(city,country): return city.title()+","+country.title()import unittest from hello_world import printnames class PrintTestCase(unittest.TestCase): def test_print(self): answer=pr...

2018-04-15 11:31:14 298

原创 W5-C2 作业

10-1print("First time:") with open("learning_python.txt") as file_object: contents=file_object.read() print(contents) print("Second time:") with open("learning_python.txt") as file_object: for line...

2018-04-08 11:41:29 681

原创 W5-C1 作业

9-1class Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_type def describe_restaurant(self): print(self.restaura...

2018-04-08 10:32:02 197

原创 W4-C2 作业

8-1def display_message(subject): print("I have learned "+subject+"!") subjects=["Unit 1","Unit 2","Unit 3","Unit 4","Unit 5"] for subject in subjects: display_message(subject)8-2def fa

2018-04-01 15:25:05 244

原创 W4-C1 作业

7-1input("What kind of car would you like to rend?") print("Let me see if I can find you a Subaru.")7-2number=int(input("How many people will be there?")) if number>8: print("Sorry, there is no de...

2018-04-01 15:08:06 132

原创 W3-C2 作业

6-1person={ "first_name":"Yuan", "last_name":"Fang", "city":"Guangzhou", "age":20, } print(person)6-2friends={ "Fang Yuan":19980114, "Zhang Tongrui":19980713,

2018-03-25 22:27:14 156

原创 W3-C1 作业

5-1name="Fang Yuan" print("Is his name is 'Fang Yuan' ?") print("I predict True.") print(name=="Fang Yuan") print(name=="fang yuan")###比较区分大小写5-2name_1="Fang Yuan" name_2="fang yuan" pri

2018-03-25 21:55:58 157

原创 W2-C2 作业

刚刚学会怎么粘贴代码4-1option=["potato","chicken","onion"] for opt in option:     print("I like "+opt+" pizza!") print("I really like pizza!")4-2animals=["dog","cat","rabbit"]

2018-03-18 11:28:44 591

原创 W2-C1 作业

3-1names=["fang yuan","han ning","yang qinglian","gao henan"]print(names[0].title())print(names[1].title())print(names[2].title())print(names[3].title())#注意title后面有()3-2names=["fang yuan","han ning&quo

2018-03-18 10:33:04 216

原创 W1-C2 作业

2-1sen="I loved FY in the past"print(sen)2-2sen="I loved FY in the past"print(sen)sen="And I still love FY now"print(sen)2-3name="FY"print("Hello "+name+", welcome to my world.")2-4name="Fang

2018-03-11 21:11:13 235

原创 W1-C1 作业

    浏览python官网,首先,全英的,看来又需要提高自己的英语水平了,不过好在多数单词还是认识的。随意看到了滚动出现的图片,原来python与c有着很大的不同,感觉学习起来,或者说但愿可以比c轻松一些。下面的即将事件和最新新闻版块也让我感受到了社群井然秩序的维护与管理,希望对于我日后学习中出现问题能提供有力的帮助。    第二就是关于假设自己是编程高手,打算实现怎样的程序。最主要的还是想为自...

2018-03-09 09:10:49 174

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除