- 博客(21)
- 收藏
- 关注
原创 SHA-1 C++实现 作业
第四次密码学实验相比于上次实验,本次实验难度没有增加。实验的主要内容就是实现SHA-1算法,而书本上对于SHA-1的介绍很详细,也有伪代码,所以实现起来并不很困难。对我而言整个程序里面最具有挑战性的就是分组与填充。由于SHA-1函数的输入是512bit的信息,我们需要将其划分为16个8位二进制变量。这个划分本应该简单,但是由于我使用的是bitset,其最多只能有效保存32位二进制,所以对于...
2018-11-05 12:04:54 2069 2
原创 十五周作业 sklearn
from sklearn import metricsfrom sklearn import datasetsfrom sklearn import cross_validationfrom sklearn.naive_bayes import GaussianNBfrom sklearn.svm import SVCfrom sklearn.ensemble import Random...
2018-06-20 13:24:26 191
原创 14周 Anscombe's quartet
Part 1For each of the four datasets…Compute the mean and variance of both x and yCompute the correlation coefficient between x and yCompute the linear regression line: y=β0+β1x+ϵ (hint: use statsmodel...
2018-06-12 18:34:19 186
原创 十三周作业 python scipy
10.ScipyExercise 10.1: Least squaresGenerate matrix A 2 Rm×n with m > n. Also generate some vector b 2 Rm.Now find x = arg minx kAx - bk2.Print the norm of the residual. import numpy as np impor...
2018-06-05 17:02:29 157
原创 12周高级编程 Matplotlib
Exercise 11.1: Plotting a functionPlot the functionf(x) = sin2(x - 2)e-x2over the interval [0; 2]. Add proper axis labels, a title, etc. 程序代码import numpy as np import matplotlib.pyplot as plt ...
2018-05-29 22:29:49 192
原创 Numpy 课后习题
NumpyGenerate matrices A, with random Gaussian entries, B, a Toeplitz matrix, where A 2 Rn×m and B 2 Rm×m,for n = 200, m = 500. import numpy as npfrom scipy.linalg import toeplitz#建立矩阵A、Bn=200m=500...
2018-05-21 21:16:16 271
原创 编程题 第九周第二节课作业
题目来自leetcode.comhttps://leetcode.com/problems/jump-game/description/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array repr...
2018-05-06 17:41:56 172
原创 编程题 第九周第一节课(4/28)作业
题目来自leetcode.comGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which give...
2018-04-29 20:23:55 133
原创 编程题 第八周第二节课作业
题目来自leetcode.comGiven an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that e...
2018-04-29 19:58:09 185
原创 编程题 第八周第一节课作业
题目来自leetcode.com11. Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints ...
2018-04-29 18:48:21 171
原创 高级编程作业11章
11.1#city_functions.pydef city_fun(city,country): _city = city +', '+ country return _city.title()#test_city_country.pyimpotr unittestfrom city_functions import city_funclass t_city_fun(unittse...
2018-04-15 20:12:06 115
原创 高级编程作业第十章
#10.1with open('hw_9.txt') as file: contents = file.read() print(contents.rstrip())with open('hw_9.txt') as file: for line in file: print(line.rstrip())with open('hw_9.txt') as ...
2018-04-06 23:13:13 236
原创 高级编程作业 第九章
#9.1class Restaurant(): def __init__(self,name,_type): self.name = name self._type = _type self.num = 0 def des_res(self): print("Resturant's name: "+self.name+"\ncuisine type: "+self._t...
2018-04-06 19:17:43 157
原创 高级编程作业第8章
homework_7.py#8.2def f_book(book): print("My favorite book is "+book.title())f_book("Wind rahame")#8.4def m_shirt(si,word='I Love Python'): print("This shirt is "+si+" size, and be printed with ...
2018-03-31 11:55:34 162
原创 高级编程作业 7章
#7.3num = input('input an int num ')num = int(num)if num%10 == 0: print('It is a multiple of 10.')else: print('It not is a multiple of 10.')#7.4pizza = []while True: pei = input('Input your ...
2018-03-28 13:06:14 140
原创 高级编程作业——6章
#6.1person = {'f_name':'Kendrick','l_name':'Lamar','age':'30','city':'LosA'}print(person)#addperson['age'] = '33'print(person['l_name']+" is "+person['age']+" years old.")del person['age']#6.4...
2018-03-25 22:53:59 131
原创 高级编程作业 第五章
#5.1#5.2xing ="Zhang"ming = "Shaoshuai"message = ["male","20","178cm","75kg"]age = 20print(xing == ming)print("zhang" == xing.lower())print(age >= 15)print(age > 2
2018-03-20 14:19:59 215
原创 高级编程作业 4.1-4.11
#4.1pizzas = ['beef','egg','chicken']for pizza in pizzas: print(pizza)for pizza in pizzas: print("I like "+pizza+" pizza")print("I don't like pizza in fact")#4.3for num in range(1,21): ...
2018-03-17 14:32:29 180
原创 高级编程作业 3.1-3.8
#3.1names = ['Anna','Bob','Candy']for name in names: print(name)#3.2sentence = ", good night."for name in names: print(name + sentence)#3.4guests = ['Audrey Hepburn','Kendrick Lamar','...
2018-03-12 22:11:21 214
原创 高级编程作业——2.1-2.10
#coding=utf-8#第一题message = "Hello Python World !"print(message+"\n")#第二题,沿用第一题的变量好了print(message)message = "My Homework"print(message+"\n")#第三题name = "alice"print("Hello "+name.title()+&
2018-03-10 12:20:13 248
原创 Python初学感想
这学期的高级编程语言课程的主讲语言是python。人生苦短,我用python,python应该是一个简洁高效的语言,在它的网站上就有这句话:Python is powerful... and fast; plays well with others; runs everywhere; is friendly & easy to learn; is Open.估计他自然敢这么说当然是...
2018-03-05 21:13:06 818 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人