![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
竹原
young,but don't have time.
展开
-
Python作业(leetcode 213)
题目描述: Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This...原创 2018-04-30 23:51:31 · 390 阅读 · 0 评论 -
Python作业(LeetCode 78)
题目描述:Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3], [1],...原创 2018-04-23 23:01:46 · 357 阅读 · 0 评论 -
Python作业(Leetcode 216)
第八周第二题Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:Input: k =...原创 2018-04-26 20:30:47 · 325 阅读 · 0 评论 -
Python作业(Leetcode 134)
1. GasStation (#134)There are N gas stations along a circularroute, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tankand it costs cost[i] of gas to travel from ...原创 2018-05-13 13:56:26 · 666 阅读 · 0 评论 -
Python作业—numpy
Numpy Generate 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.Exercise 9.1: Matrix operationsCalculate A + A, AA>; A>A and AB. W...原创 2018-05-20 14:25:12 · 454 阅读 · 0 评论 -
Python作业——Scipy
Exercise 10.1: Least squaresGenerate matrix A 2 Rm×n with m > n. Also generate some vector b 2 Rm.Now find x = arg minx ||Ax - b||. Print the norm of the residual. Exercise 10.2: OptimizationFind t...原创 2018-06-04 00:23:56 · 278 阅读 · 0 评论 -
Python作业-Matplotlib
Python高级编程技术Matplotib部分Exercise 11.1: Plotting a functionPlot the function f(x) = sin2(x - 2)e-x2 over the interval [0; 2]. Add proper axis labels, a title, etc. import mat...原创 2018-05-28 19:53:54 · 233 阅读 · 0 评论 -
Python作业-Jupyter-数据集分析
目标:学习使用Jupyter NoteBook 以及python库中的数据分析函数exercise链接:https://nbviewer.jupyter.org/github/schmit/cme193-ipython-notebooks-lecture/blob/master/Exercises.ipynb题目要求:1.Part 1For each of the four datasets......原创 2018-06-11 00:17:44 · 3455 阅读 · 0 评论 -
Python作业——sklearn
Scikit-Learn: Machine Learning in Python学习目标:学习python库中的sklearn,掌握三种分类方法:朴素贝叶斯、SVM和随机森林。通过完成assignment,对结果进行对比分析,简要概括训练成果。Assignment :In the second ML assignment you have to compare the performance of...原创 2018-06-20 00:29:38 · 432 阅读 · 0 评论 -
Python作业(8.1-8.16)
Python第8章作业8-1 消息 : 编写一个名为display_message() 的函数, 它打印一个句子, 指出你在本章学的是什么。 调用这个函数, 确认显示的消息正确无误。 def display_message(): print("In this chapter,I will learn how to use function")display_message() 8-2 喜欢的图...原创 2018-03-28 20:29:08 · 3398 阅读 · 0 评论 -
Python作业(9.1-9.14)
Python第九章作业9-1 餐馆 : 创建一个名为Restaurant 的类, 其方法__init__() 设置两个属性: restaurant_name 和cuisine_type 。 创建一个名为describe_restaurant() 的方法和一个名为open_restaurant() 的方法, 其中前者打印前述两项信息, 而后者打印一条消息, 指出餐馆正在营业。根据这个类创建一个名为r...原创 2018-04-03 20:35:03 · 2831 阅读 · 0 评论 -
Python作业(2.1-2.11)
#2018.03.08 第一周Python作业2.1 简单消息: 将一条消息存储到变量中, 再将其打印出来。 my_value="I am learning Python ."print(my_value)2.2 多条简单消息: 将一条消息存储到变量中, 将其打印出来; 再将变量的值修改为一条新消息, 并将其打印出来。 my_value="I am learning Python ."p...原创 2018-03-08 20:02:54 · 588 阅读 · 0 评论 -
Python作业(3.1-3.9 )
Python作业(3.1-3.9)3-1 姓名: 将一些朋友的姓名存储在一个列表中, 并将其命名为names 。 依次访问该列表中的每个元素, 从而将每个朋友的姓名都打印出来。 names=['XiaoYing','HanQian','XuYiDan']print(names[0])print(names[1])print(names[2])3-2 问候语: 继续使用练习3-1中的列表, 但...原创 2018-03-12 08:41:29 · 1170 阅读 · 0 评论 -
Python作业(4.1-4.13)
Python第四章 操作列表4-1 比萨 : 想出至少三种你喜欢的比萨, 将其名称存储在一个列表中, 再使用for 循环将每种比萨的名称都打印出来。修改这个for 循环, 使其打印包含比萨名称的句子, 而不仅仅是比萨的名称。 对于每种比萨, 都显示一行输出, 如“I like pepperoni pizza”。在程序末尾添加一行代码, 它不在for 循环中, 指出你有多喜欢比萨。 输出应包含针对每...原创 2018-03-19 23:02:13 · 1169 阅读 · 0 评论 -
Python作业(5.1-5.11)
Python第五章作业5-2 更多的条件测试 : 你并非只能创建10个测试。 如果你想尝试做更多的比较, 可再编写一些测试, 并将它们加入到conditional_tests.py中。 对于下面列出的各种测试, 至少编写一个结果为True 和False 的测试。检查两个字符串相等和不等。使用函数lower() 的测试。检查两个数字相等、 不等、 大于、 小于、 大于等于和小于等于。使用关键字and...原创 2018-03-20 23:08:59 · 1598 阅读 · 0 评论 -
Python作业(6.1-6.11)
Python第六章作业6-1 人 : 使用一个字典来存储一个熟人的信息, 包括名、 姓、 年龄和居住的城市。 该字典应包含键first_name 、 last_name 、 age 和city 。 将存储在该字典中的每项信息都打印出来。person={ 'first_name':'Yuan', 'last_name' :'Xu', 'age':'19', 'city':'...原创 2018-03-21 19:53:59 · 2109 阅读 · 0 评论 -
Python作业(10.1-10.12)
Python第10章作业10-1 Python学习笔记 : 在文本编辑器中新建一个文件, 写几句话来总结一下你至此学到的Python知识, 其中每一行都以“In Python you can”打头。 将这个文件命名为learning_python.txt, 并将其存储到为完成本章练习而编写的程序所在的目录中。 编写一个程序, 它读取这个文件, 并将你所写的内容打印三次: 第一次打印时读取整个文件;...原创 2018-04-09 08:38:52 · 3545 阅读 · 0 评论 -
Python作业(11.1-11.3)
Python第11章作业11-1 城市和国家 : 编写一个函数, 它接受两个形参: 一个城市名和一个国家名。 这个函数返回一个格式为City, Country 的字符串, 如Santiago, Chile 。 将这个函数存储在一个名为city_functions.py的模块中。创建一个名为test_cities.py的程序, 对刚编写的函数进行测试(别忘了, 你需要导入模块unittest 以及要...原创 2018-04-09 22:12:51 · 661 阅读 · 0 评论 -
Python作业(7.1-7.10)
Python第七章作业7-1 汽车租赁 : 编写一个程序, 询问用户要租赁什么样的汽车, 并打印一条消息, 如“Let me see if I can find you a Subaru”。 car=input("What kind of car would you like to rent?")print("Let me see if I can find you a "+car+".")7-...原创 2018-03-26 19:46:46 · 1078 阅读 · 1 评论 -
leetcode189 && 155
@[TOC]leetcodeleetcode189. Rotate ArrayGiven an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Explanat...原创 2019-08-18 23:05:10 · 142 阅读 · 0 评论