Fork me on GitHub
摘要: 1、用ELIF比较省CPU: 第一种方法,使用if score = int(input('请输入你的分数:')) if (score <= 100) and (score >= 90): print('A')if (score <= 89) and (score >= 80): print ("B" 阅读全文
posted @ 2017-04-21 22:21 Mo槑 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 1、not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9 结果会输出啥? 根据优先级:(not 1) or (0 and 1) or (3 and 4) or (5 and 6) or (7 and 8 and 9) 之后剩下:0 or 0 阅读全文
posted @ 2017-04-21 20:33 Mo槑 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 1、chop函数:删除标量变量或数组中每个字符的最后一个字 举个栗子: #!/usr/bin/perl $v = 'Flowers'; $r = chop($v); print "$v (without $r)\n"; 阅读全文
posted @ 2017-04-21 15:23 Mo槑 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 1、是函数就有返回值: 比如:chomp函数,其可以除去换行符,但其也有返回值 chomp($xx) #这是去除xx的换行符 $yy=chomp($xx) #这是看这次除去了几个换行符,也就是函数运算了几次 2、 阅读全文
posted @ 2017-04-21 15:13 Mo槑 阅读(180) 评论(0) 推荐(0) 编辑