自定义博客皮肤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)
  • 收藏
  • 关注

原创 sklearn练习

Codeimport numpy as npfrom sklearn import metricsfrom sklearn import datasetsfrom sklearn.model_selection import KFoldfrom sklearn.naive_bayes import GaussianNBfrom sklearn.svm import SVCfrom sk...

2018-06-26 20:18:59 230

原创 Jupyter Notebook练习

2018-06-26 18:39:43 646

原创 scipy库练习

Ex 10.1Codeimport numpy as npimport matplotlib.pyplot as pltimport scipy.linalg as linm=3n=3A=np.random.random((m,n))b=np.random.random((m,1))x,res,rnk,s=lin.lstsq(A,b)print(lin.norm(b-A.dot(...

2018-06-25 21:19:51 362

原创 matplotlib库练习

Ex 11.1Codeimport numpy as npimport matplotlib.pyplot as pltfrom pylab import *x=linspace(0,2,1000)y=sin(x-2)**2*exp(-x**2)fig, ax=plt.subplots()ax.plot(x,y)ax.set_xlabel('x')ax.set_ylabel('y...

2018-06-24 14:56:12 220

原创 Numpy库练习

Exercise 9.1: Matrix operations Calculate A + A, AA>,A>A and AB. Write a function that computes A(B−λI) for any λ. import numpydef calc(A,B,x): I=numpy.eye(m) return numpy.dot(A,B-I*x)...

2018-05-22 20:33:12 482

原创 LeetCode 3.Longest Substring Without Repeating Characters

DescriptionGiven a string, find the length of the longest substring without repeating characters.Solution循环一遍,每次对当前位置之前的每个字母从后往前第二次出现的位置取max,与当前位置做差,即得到答案,用字典实现复杂度为O(n)Codeclass Solution(object): ...

2018-05-22 20:29:24 121

原创 LeetCode2. Add Two Number

DescriptionYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers a...

2018-05-22 20:26:04 136

原创 LeetCode1. two sum

DescriptionGiven 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 ...

2018-05-22 20:24:46 142

原创 leetcode532

Description:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are bot...

2018-04-30 02:27:30 355

原创 python学习——测试函数

题目参照《python编程——从入门到实践》第十一章习题11-1、11-2city_functions.pydef city_name(city,country,population=''): name=city+','+country if population: name+='-population '+str(population) return name.title()test...

2018-04-15 19:34:22 614

原创 python学习——文件和异常

题目参照《python编程——从入门到实践》第十章习题10-1with open('learning_python.txt') as file_object: contents=file_object.read() print(contents)with open('learning_python.txt') as file_object: for line in file_object:...

2018-04-09 01:50:28 214

原创 python学习——类

题目参照《python编程——从入门到实践》第九章习题9-1、9-2、9-4、9-6、9-10restaurant.pyclass Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_t...

2018-04-08 23:23:50 188

原创 python学习——函数

题目参照《python编程——从入门到实践》第八章习题8-1def display_message(message): print(message)display_message('function')8-2def favorite_book(book): print('One of my favorite books is '+book)favorite_book('Alice in ...

2018-04-01 18:11:02 232

原创 python学习——用户输入和while循环

题目参照《python编程——从入门到实践》第七章习题7-1car = input('what kind of car do you want? ')print('let me see if i can find you a '+car)7-2while True: age=input('How old are you? ') if age=='quit': break else:...

2018-04-01 17:40:54 332

原创 python学习——字典

题目参照《python编程——从入门到实践》第六章习题6-1、6-7people_1={ 'first_name':'li', 'last_name':'yang', 'age':20, 'city':'Guangzhou', }people_2={ 'first_name':'jiang', 'last_name':'zixiao', 'age':20, 'city':'Gu...

2018-03-25 22:29:43 162

原创 python学习——if语句

题目参照《python编程——从入门到实践》第五章习题5-5aline_color='red'if aline_color=='green': print("you get 5 points")elif aline_color=='yellow': print("you get 10 points")else: print("you get 15 points")5-8、5-9、5-...

2018-03-25 21:41:25 310

原创 python学习——操作列表

题目参照《python编程——从入门到实践》第四章习题4-1、4-11pizzas=['seafood','meat','vegetable']for pizza in pizzas: print('I like '+pizza+' pizza.')print('I really love pizza!')friend_pizzas=pizzas[:]pizzas.append('pla...

2018-03-18 22:39:05 177

原创 python学习——修改、添加和删除元素

在上周简要的学习了一下python列表的一些操作,并做了做《python编程——从入门到实践》第三章的一些例题。3-1、3-2names=['tony','tom','marry']print(names[0])print(names[1])print(names[2])print('hello,'+names[0])print('hello,'+names[1])print('hel...

2018-03-18 21:32:59 476

原创 python学习——变量和简单数据类型

2-1功能:将一条消息存储到变量中,再将其打印出来。代码如下:message="try to send something"print(message)2-2功能:将一条消息存储到变量中,将其打印出来,再经过一次修改并再次打印。代码如下:message="try to send something"print(message)message="change it"print(messag...

2018-03-10 16:46:30 243

原创 初识python暨高级编程技术第一次作业

1. python的官网采用了非常简洁耐看的排版,模块划分一目了然,作为一个python萌新,我仔细阅读了python的成功故事,python的成功故事讲了ILM公司对于python的使用,故事中提及了python的几个优点——可以嵌入到整个软件系统;具有可扩展性;多功能性;可移植性。这就使得python始终作为ILM公司的最佳选择。2. 如果我是一个python大牛,我打算通过python制作一...

2018-03-05 20:59:06 386

空空如也

空空如也

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

TA关注的人

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