首页 > 编程语言 > 详细

python 简明扼要教程

时间:2020-11-23 15:12:11      阅读:27      评论:0      收藏:0      [点我收藏+]

根据SICP,一门语言有以下模式:

  • primitive expressions, which represent the simplest entities the
    language is concerned with,

  • means of combination, by which compound elements are built
    from simpler ones, and

  • means of abstraction, by which compound elements can be named
    and manipulated as units.

Combination

if

if xxx:
elif xxx:
elif xxx:
else:

for

for x in array:
for x,y in tuple:

range()

It is an object which returns
the successive items of the desired sequence when you iterate over it, but it doesn’t really make the list, thus saving space.

特色

range(5)
## 5为上界
      0, 1, 2, 3, 4
## 5为下界,10为上界
range(5, 10)
      5, 6, 7, 8, 9
range(5, 10, 4)
## 4为步长
      5, 9
range(-10, -100, -30)
## 注意上下界

python 简明扼要教程

原文:https://www.cnblogs.com/Neteraxe/p/14023704.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!