![](https://i-blog.csdnimg.cn/columns/default/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Python学习笔记
someday1314
这个作者很懒,什么都没留下…
展开
-
Python编程练习
#古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? i=1 k=0 def f(n): if n==1 or n==2: return 2 return f(n-1)+f(n-2) i=1 while i>=1 and i<=24: if i==1 or i==2: prin...原创 2019-12-24 17:14:40 · 253 阅读 · 0 评论 -
Python学习笔记(3)
一、Python运算符 1、算术运算符 幂**:返回x的y次幂 print 2**3 print 2**4 #结果 8 16 取整除\\:取整除,返回商的整数部分(向下取整) print 9//2 print -9//2 #结果 4 -5 2、Python的成员运算符 ...转载 2019-12-20 16:45:08 · 1285 阅读 · 0 评论 -
Python的学习笔记(2)Python的基础
一、变量类型 以下为与C基础不同的注意点 在python中还允许用r''表示单引号中的内容默认不转义。示例如下: print("hello world\n") print(r'hello world\n') 运行结果如下: hello world hello world\n 如果字符串中有很多要换行的,需要写很多\n,不好阅读,python允许用'''...'''的格式表示多行内容。示...转载 2019-12-20 15:21:05 · 347 阅读 · 0 评论 -
Python学习笔记(1)之python的基本语法
一、python的输入和输出 1、python的输出 使用print()加字符串可以在屏幕中输出指定的字符串,如下 print("Hello World") print()函数可以接受多个字符串输出,中间用逗号隔开,遇到逗号会输出一个空格,故以下输出结果会连成一句话。 print('The quick brown fox', 'jumps over', 'the lazy dog') ...原创 2019-12-20 11:21:25 · 278 阅读 · 0 评论