- 博客(15)
- 资源 (2)
- 收藏
- 关注
原创 高级编程技术作业:numpy
高级编程技术作业:numpy9-1:from scipy.linalg import toeplitzimport numpy as npn=200m=500a=[]for i in range(0,200): a.append(np.random.randn(m))a=np.array(a)tempc=np.array(np.arange(m))tempc=temp...
2018-05-23 18:20:58
668
原创 高级编程技术leetcode作业1
27. Remove ElementGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifyin...
2018-04-30 11:47:58
202
原创 第八次作业(第十章)
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: print(line.rstrip()...
2018-04-08 00:34:28
231
原创 第七次作业(第九章)
9-3class User(): def __init__(self,first_name,second_name): self.first_name=first_name self.second_name=second_name def describe_user(self): print("The current customer is "+self.first_name.ti...
2018-04-08 00:27:41
267
原创 第六次作业(第八章)
8-2def favorite_book(book): print("My favorite book is "+book)favorite_book('Alice in wonderland')8-5def describe_city(city,country): print(city+' is in '+country)describe_city('New York','Americ...
2018-04-01 12:31:51
191
原创 第五次作业(第七章)
7-3num=input("please input a number")num1=int(num)if num1%10==0: print(num+" can mod 10")else: print(num+" cannot mod 10 ")7-4message="Please input the ingredients of pizza:\n"message=message+...
2018-04-01 00:13:21
182
原创 第四次作业
5-2s1='aabbcc's2='AAbbcc'if s1==s2: print('s1==s2') print(s1==s2)else: print('s1!=s2') print(s1==s2)if s1.lower()==s2.lower(): print('True')if 3>2: print('3>2')if 4<=5: print('4&...
2018-03-26 00:53:53
146
原创 第三次作业
4-2animals=['dog','cat','cow']for animal in animals: print(animal) print('A '+animal.title()+' would make a great pet.\n')print('Any of these animals would make a great pet!\n')4-5array=[]for va...
2018-03-26 00:47:35
171
原创 第二次作业
3-6guest=["Tom", "Jack", "Marry"]message="I want to invite "+guest[0]+" "+guest[1]+" "+guest[2]print(message)not_come="Jack"guest.remove(not_come)print(not_come+" will not come
2018-03-14 19:24:39
130
原创 假如我成为一名python高手,我想实现怎样的目标
假如我熟练掌握了Python这门语言,我想利用Python做一个坦克对战这类的小游戏,虽然简单,但是对于Python这门语言的应用还是极为有助的。
2018-03-10 17:46:09
334
原创 第一次作业:浏览Python主页的感想
Python主页主要提供了Python语言特性的一些介绍,Python解释器的下载,以及学习Python的一些社区和书籍介绍等,通过浏览Python主页,我发现Python是一门使用起来更贴近于自然语言的一种编程语言,它使编程者更易于掌握和书写,同时python的另一强大功能便是书写简洁,通过较少而简单的语句即可达到和C/C++语言需要写较多才能达到的功能,因为Pyhton是解释型语言,所...
2018-03-10 17:27:18
219
转载 #define中宏定义中的空格
宏定义中的空格 另外还有一个问题需要引起注意,看下面例子:#define SUM (x) (x)+(x)复制代码 这还是定义的宏函数SUM(x)吗?显然不是。编译器认为这是定义了一个宏:SUM,其代表的是(x) (x)+(x)。 为什么会这样呢?其关键问题还是在于SUM 后面的这个空格。所以在定义宏的时候一定要注意什么时候该用空格,什么时候
2017-10-21 14:12:16
9834
转载 一个类的成员函数声明为另一个类的友元函数
友元提供了不同类的成员函数之间、类的成员函数与一般函数之间进行数据共享的机制。通过友元,一个不同函数或另一个类中的成员函数可以访问类中的私有成员和保护成员。c++中的友元为封装隐藏这堵不透明的墙开了一个小孔,外界可以通过这个小孔窥视内部的秘密。友元的正确使用能提高程序的运行效率,但同时也破坏了类的封装性和数据的隐藏性,导致程序可维护性变差。友元提供了不同类的成员函数之间、类的成员函
2017-10-12 14:00:51
8170
2
转载 C++编译器默认生成的函数
class Empty {public: Empty(); // 缺省构造函数 Empty(const Empty& rhs); // 拷贝构造函数 ~Empty(); // 析构函数 ---- 是否 // 为虚
2017-10-01 19:03:20
1019
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人