摘要: #include typedef struct Node { int a,b; }node; node c[100]; int n; void print() { int i; printf("\n当前数据:\n"); for(i=1;i<=n;i++) { printf("第%d组:a=%d,b=%d\n",i,c[i].a,c[i]... 阅读全文
posted @ 2019-04-06 14:12 LXL_1 阅读(786) 评论(0) 推荐(0) 编辑
摘要: //数组 # include # include //包含了 malloc 函数 # include //包含了 exit 函数 struct Arr //定义了一个叫struct Arr 的数据类型没有定义变量 { int * pBase; //存储的是数组第一个元素的地址 int len; //数组能容纳的元素的个数 int cnt; //当前数组的有效的元... 阅读全文
posted @ 2019-04-06 14:11 LXL_1 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #闭包:嵌套函数,内部函数 并且必须调用外部函数的变量 def outer(): a = 1 def inner(): print(a) inner() print(inner.__closure__) # 说明是一个闭包函数 outer() def outer(): a = 1 def inner(): prin... 阅读全文
posted @ 2019-04-06 04:01 LXL_1 阅读(156) 评论(0) 推荐(0) 编辑
摘要: def max(a,b): return a if a>b else b def the_max(x,y,z): #函数的嵌套调用 c = max(x,y) return max(c,z) print(the_max(1,2,3)) #函数的嵌套定义 #内部函数可以使用外部函数的变量 a = 1 def outer(): a = 1 def inn... 阅读全文
posted @ 2019-04-06 03:37 LXL_1 阅读(337) 评论(0) 推荐(0) 编辑
摘要: # 函数进阶 a = 1 def func(): print(a) func() # 命名空间和作用域 # print() # input() # list # #命名空间 有三种 #内置命名空间 —— python解释器 # 就是python解释器一启动就可以使用的名字存储在内置命名空间中 # 内置的名字在启动解释器的时候被加载进内存里 #全局命名空间 —— 我们写... 阅读全文
posted @ 2019-04-06 02:47 LXL_1 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 习题 阅读全文
posted @ 2019-04-05 16:19 LXL_1 阅读(390) 评论(0) 推荐(0) 编辑
摘要: # Topic: There are four digits: 1, 2, 3 and 4. # How many different three digits can be formed without repeating numbers? How much is each? # Procedure analysis: traverse all possibilities and shav... 阅读全文
posted @ 2019-04-05 14:14 LXL_1 阅读(277) 评论(0) 推荐(0) 编辑
摘要: # Python基础数据类型考试题# 考试时间:两个半小时 满分100分(80分以上包含80分及格)# 一,基础题。# 1,简述变量命名规范(3分)# 答:变量名是由数字、字母、下划线任意组合,变量名要具有描述性,不能是Python关键字,不能是数字开头,不能是中文。# 2,字节和位的关系。(2分) 阅读全文
posted @ 2019-04-04 23:18 LXL_1 阅读(286) 评论(0) 推荐(0) 编辑
摘要: #len s = '金老板小护士' len(s) def my_len(): #自定义函数 i = 0 for k in s: i += 1 print(i) length = my_len() print(length) #函数没有返回值所以打印None 结果:# None # 函数 # 定义了之后,可以在任何需要它的地方调用 # 没有返回长度,... 阅读全文
posted @ 2019-04-04 17:01 LXL_1 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 命令替换:bash7步扩展的之一 嵌套 这里没什么意义 退出状态可以参与逻辑判断 表达式 算数表达式和条件表达式,逻辑表达式 查看passwd命令比,避免用户捕获输入密码的接口 这种方式就可以直接输入密码, 或者在 god 后面加0 标准输入 &> 表示将所有的输出都传到那里 包括 1, 2正确错误 阅读全文
posted @ 2019-04-04 01:23 LXL_1 阅读(281) 评论(0) 推荐(0) 编辑