Python Learning: 02
OK, let's continue.
- Conditional Judgments and Loop
- if
- if-else
- if-elif-else
- while
- for
- break
- continue
- multiple loop
- Differences between Dict and Set
- Dict: A kind of structure in the type of "Key-Value"
- described in "{}"
- formed by "key: value"
- function "len()" to calculate the length
- judge empty:① if 'key' in dict ②dict.get('key') ->if empty, return None automatically
- the key in dict is unchangeable
- Set: A kind of struture in the type of Non-repeating elements collection
- described in "set([,,,,])"
- add() to add elements
- remove() to delete elements
- Dict: A kind of structure in the type of "Key-Value"
- Functions
- where to searching functions:
http://docs.python.org/2/library/functions.html#abs
- some common functions: abs(), cmp(), int(), str(), sum()
- the Return Value of Functions
A function can return single value, as well as return more value. But in essence it returns one, a tuple. The function treats the values as a tuple.
>>> r = move(100, 100, 60, math.pi / 6)
>>> print r
(151.96152422706632, 70.0)
- recursive functions: take care of overflowing
- default parameter: set default parameter in the function line in the blankets, and the default parameter must be set at the right side
- variable parameter: use '*' to mark variable parameter , and they are regarded as a tuple
Python Learning: 02的更多相关文章
- Python学习02 列表 List
Python学习02 列表 List Python列表 List Python中的列表(List)用逗号分隔,方括号包围(comma-separated values (items) between ...
- Python网络02 Python服务器进化
原文:Python网络02 Python服务器进化 作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! **注意,在Python 3. ...
- python learning Exception & Debug.py
''' 在程序运行的过程中,如果发生了错误,可以事先约定返回一个错误代码,这样,就可以知道是否有错,以及出错的原因.在操作系统提供的调用中,返回错误码非常常见.比如打开文件的函数open(),成功时返 ...
- python进阶02 特殊方法与特殊属性
python进阶02 特殊方法与特殊属性 一.初始化.析构 1.初始化 # python中有很多双下划线开头且以下划线结尾的固定方法,它们会在特定的时机被触发执行,这便是特殊方法 # 在实例化的时候就 ...
- Python模块02/序列化/os模块/sys模块/haslib加密/collections
Python模块02/序列化/os模块/sys模块/haslib加密/collections 内容大纲 1.序列化 2.os模块 3.sys模块 4.haslib加密 5.collections 1. ...
- Python函数02/函数的动态参数/函数的注释/名称空间/函数的嵌套/global以及nolocal的用法
Python函数02/函数的动态参数/函数的注释/名称空间/函数的嵌套/global以及nolocal的用法 目录 Python函数02/函数的动态参数/函数的注释/名称空间/函数的嵌套/global ...
- Python面向对象02/类的空间问题、类与对象之间的关系、类与类之间的关系
Python面向对象02/类的空间问题.类与对象之间的关系.类与类之间的关系 目录 Python面向对象02/类的空间问题.类与对象之间的关系.类与类之间的关系 1. 类的空间问题 2. 类与对象之间 ...
- Python Learning Paths
Python Learning Paths Python Expert Python in Action Syntax Python objects Scalar types Operators St ...
- (python函数02)列表生成式
(python函数02)列表生成式 示例代码 num = [i for i in range(1, 10)] print(num) num = [i for i in range(1, 10) ...
随机推荐
- 驰骋工作流引擎 -CCBPM如何自动升级
关键词:工作流引擎自动升级 工作流自动升级升级步骤设置1,CCBPM把更新分成三类, 应用程序代码更新.数据表结构更新.数据更新.2,CCBPM在您登录流程设计器时自动判断当前的版本与数据库版本是 ...
- arcgis api 4.x for js 结合 react 入门开发系列"esri-loader"篇(附源码下载)
基于上篇的介绍,虽然有比较esri-loader.@arcgis/webpack-plugin,还是觉得有必要需要讲述一下“esri-loader”的开发模式,待大家体验后也会有更直观的感受.本篇文章 ...
- 【SQL Server】利用游标将学生表中的成绩转化为绩点
软件工程综合实践第一次作业 代码来源:班上同学的数据库大作业 alter table sc add GPA float; --加入绩点列 alter table sc ,);--将表按原始位置顺序编号 ...
- Linux 桌面玩家指南:03. 针对 Gnome 3 的 Linux 桌面进行美化
特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之 ...
- 音视频 学习&开发&测试 资源
一.FFmpeg 学习 1. 官方API文档 FFmpeg Documentation:http://www.ffmpeg.org/doxygen/trunk/index.html 2. 优秀开源项目 ...
- Android 音视频开发学习思路
Android 音视频开发这块目前的确没有比较系统的教程或者书籍,网上的博客文章也都是比较零散的.只能通过一点点的学习和积累把这块的知识串联积累起来. 初级入门篇: Android 音视频开发(一) ...
- IDEA:Maven项目找不到mapper文件 无法自动映射
如果你发现所有的功能都报找不到映射的错,有可能是因为mapper文件没有被编译 在eclipse中,把资源文件放在src下,是可以被编译的 但是在idea中,直接把资源文件放在src下,如果不进行设置 ...
- [Swift]LeetCode1034.边框着色 | Coloring A Border
Given a 2-dimensional grid of integers, each value in the grid represents the color of the grid squa ...
- 中文分词实战——基于jieba动态加载字典和调整词频的电子病历分词
分词是自然语言处理中最基本的一个任务,这篇小文章不介绍相关的理论,而是介绍一个电子病历分词的小实践. 开源的分词工具中,我用过的有jieba.hnlp和stanfordnlp,感觉jieba无论安装和 ...
- KnockoutJS-模板绑定
对于knockoutJS来讲,模板绑定和Mapping插件绑定是十分重要的功能,虽然模板绑定在我工作中用的及其少,但模板绑定的重要性不可忽视,在其他前端框架中,如Angular.Vue等等,模板存在的 ...