- 博客(21)
- 收藏
- 关注
原创 string/char*/char**/字符串常量间的关系——C++笔记(一)
1、字符串常量/char/char a[]/char*/char**/string之间的关系stringstring C++的标准库类型(vector也是标准库类型),表示可变长的字符序列。使用时需要在头文件中包含#include <string>using std::string初始化string对象的方式string s; //默认初始化,是一个空串string s2(s1); //直接初始化,s2是s1的副本string s3("value"
2021-03-01 00:11:53
348
原创 python习题练习(八)
参考书籍:python程序设计chapter10.3.#This pro let user choose a button and show the result(right or wrong).from button import Buttonfrom graphics import *from random import randrangedef drawWin():...
2019-01-18 21:14:57
801
原创 python习题练习(七)
参考书籍:python程序设计chapter91.from random import randomdef main(): printIntro() probA, probB, n = getInputs() winsA, winsB = simNGames(n, probA, probB) printSummary(winsA, winsB)...
2019-01-16 22:36:33
941
原创 python习题练习(六)
参考书籍:python程序设计chapter8.testfrom graphics import *def handlekey(k, win): if k == "r": win.setBackground("pink") if k == "w": win.setBackground("white") if k == "g"...
2019-01-14 20:52:42
617
原创 python习题练习(五)
参考书籍:python程序设计chapter75.#This pro print the healthy level based on the BMI.#input:weight(kg), and height(cm).#output:healthy leveldef ConvertWeight(weight): #This pro convert weight kg...
2019-01-08 22:44:40
618
原创 python习题练习(四)
参考书籍:python程序设计chapter6.test#happy2.py#This pro is a exercise in the book.def happy(): return "Happy Birthday to you!\n"def verseFor(person): lyrics = happy() * 2 + "Happy birthday,...
2019-01-07 21:21:05
452
原创 python习题练习(三)
参考书籍:python程序设计chapter51.def main(): print("This pro converts the date.") #input date = input("Please input the date (mm/dd/yyyy):") #split into components month, day, yea...
2019-01-03 22:32:35
325
原创 python习题练习(二)
参考书籍:python程序设计chapter41.from graphics import *def main(): win = GraphWin() shape = Rectangle(Point(10,10), Point(20, 20)) shape.setOutline('green') shape.setFill('blue') ...
2019-01-02 22:24:51
284
原创 python习题练习(一)
参考书籍:python程序设计chapter 15.print("This program illustrates a chaotic function")x = eval(input("Enter a number between 0 and 1:"))n = eval(input("How many times shoule I print?"))for i in rang...
2019-01-02 22:21:04
599
原创 python绘图基础
参考网页https://blog.csdn.net/anneqiqi/article/details/64125186https://blog.csdn.net/helunqu2017/article/details/78614640https://zhidao.baidu.com/question/942252736312635572.html?qbl=relate_question...
2018-12-17 12:01:10
458
原创 python基础学习笔记(六)——迭代器iterators和生成器generators
注意python的编程习惯,定义函数的空行和数学符号前后的空格。chapter9迭代器 官方文档 参考网页迭代器是一个带状态的对象,在调用next()方法的时候返回容器中的下一个值,否则进入休眠状态等待被调用。iter()函数用来创建一个可迭代对象的迭代器my_iter=iter([1,2,3])print(my_iter)<list_iterato...
2018-09-16 22:43:50
413
原创 python基础学习笔记(五)——类和继承class
类class面向对象的程序设计中的一种数据结构,内部包括数据(属性)和函数(对属性进行操作)。面向对象的程序设计三个特性:封装、继承和多态,是基于类和对象的操作。注意类的定义格式,每个类都包括一个初始化函数(构造函数)来初始化数据。注意:类中定义的每一个函数都有一个默认参数self(用于封装),且必须为第一个参数.class Person: def __init__(s...
2018-09-12 11:04:16
577
原创 python基础学习笔记(四)——字典dictionary
chapter7 字典字典是一种类似于列表的数据结构,不同之处在于用自定义的关键字作为数据的索引,且每个关键字下的数据内容可为多个。注意列表的定义格式(此处用字符串作为字典的索引)ages={ "Peter":10, "Isabel":11, "Anna":9, "Thomsas":10, "Bob":10, "Joseph":
2018-09-10 21:02:40
300
原创 python基础学习笔记(三)——循环for and while
chapter6 迭代和循环for语句在python中最常用的循环是for语句,常与列表list共同使用,注意for语句的格式。计算列表中元素的平均值for value in [0,1,2,3,4,5]: print(value*value)01491625计算列表中所有元素的和mylist=[1,5,7]s=0for val in mylis...
2018-09-08 21:53:41
600
原创 python基础学习笔记(二)——数学模块math modules和(递归)函数functions
chapter5 模块和函数math模块 参考模块的数学运算由C语言的标准库定义,永久有效。只支持实数运算,cmath模块支持复数运算。返回结果大部分为浮点型。具体各函数作用math.gcd()函数,计算两个数的最大公约数。注意:只能是两个数math.log2(x)函数,计算以2为底,x的对数。math.log10(x)函数,计算以10为底,x的对数。math....
2018-09-08 16:33:06
611
原创 python基础学习笔记(一)——数据类型stdtypes和列表list
机器之心整理参考python官方说明chaper3 数字和字符串数字:分为int和float,可以相互转换。注意:在int型数字计算平均值的过程中,无论计算结果是整数还是浮点数,结果都为float型。关于布尔型字符串计算字符串长度的函数len()s='abc'a=len(s)print(a)str.capitalize()函数,返回的字符串首字母大...
2018-09-07 17:48:16
546
原创 Ubuntu系统的基本使用(一)
学习RL的原因,需要与新的系统进行磨合。总结一下最近看到的学习资料。1.ubuntu的基本操作指令Linux系统基础教程 记录一些基本的操作(1) ls(list) 罗列出当前文件夹下的文件,但是不包括(.后缀)的隐藏文件。 ls -a (all) 可罗...
2018-09-01 12:02:32
36083
原创 python代码实现无人机控制学习笔记
quad_sim.py1.signal模块 通信模块linux系统的通信基础 linux简单通信基础 linux系统中内核通过信号(signal)对进程进行作出指令,信号发出-等待-执行python中的signal模块用来处理python进程中的信号 signal模块signal.signal(signal.SIGINT, signal_handler) 使用signal.sign...
2018-08-13 17:06:19
15050
原创 学习DDPG机械手臂算法笔记
1.关于pyglet点击打开链接 一个实时刷新的做动画模块 pyglet.gl.glClearColor(1, 1, 1, 1) 窗口背景颜色 self.batch=pyglet.graphics.Batch()点击打开链接 pyglet.graphics.Batch()用于产生一个图形的数组,存储在batch中 点击打开链接 self.batch.draw...
2018-07-19 09:50:41
4264
原创 学习DDPG算法倒立摆程序遇到的函数
1.np.random.seed点击打开链接2.tf.set_random_seed(1)点击打开链接应该和1类似,产生图级的随机序列。那1就是产生操作级的随机序列吧。3.dict(name = 'soft', tau = 0.01) python中的结构形式,create empty dictionary4.tf.variable_scope点击打开链接点击打开链接用来管理相同环境中的同名变量。...
2018-07-12 19:17:32
3417
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人