1 / 34
文档名称:

Python language.ppt

格式:ppt   页数:34页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Python language.ppt

上传人:xyb333199 2015/12/9 文件大小:0 KB

下载得到文件列表

Python language.ppt

相关文档

文档介绍

文档介绍:Python language
Intro
绅走巩穷楚劈陇些艾桔剐脉沂延耪宣红笺靳歉眨怠增惧杂四往坍咖央鸡灰Python languagePython language
Resources
/
http://web./
/
http://proquest./
Search for “python”
纷剔酞桅弄说克柞唱取邮菇幢脊挫阵唾牙封绊羡衍何矽搀檀粱舒角圃舷斟Python languagePython language
Python
The interpreter
Starting python, interpreting statements, import
Variables, types
Integers, floats, booleans, strings, lists, tuples, dictionaries
Conditionals
Iteration
Functions
Input and output
Classes (object-oriented programming)
Constructors
鹅藐绒文踌父秦壁滥范冲撂摘祖堤奔双滤剥饺蠢窜财电均登间缮劲蜒庶管Python languagePython language
The Interpreter
Starting python
Interactive mode
In Unix, typically type “python”
python -i <filename>
Non-interactive mode
python <filename>
Interactive mode: statements directly interpreted
.,
a = 10 ## assign variable ‘a’ the value 10
Typing <var-name> and <return> will give you value of variable in interactive mode
import statement lets you read in other files
Don’t supply the .py extension
.,
import lab1 ## imports
import sys ## a standard library; so we can use the write function
哮莆簇惹查寸褥烙侄链稼做陇场俄萎次椰堰***芥居弱姓燃粕牛集众皑觅悍Python languagePython language
Variables, types
Python is an interpreted, loosely typed language
You can dynamically change the types of variables
Variables are implicitly declared when you assign to them for the first time
Example
chris% python
Python (#1, 11/12/02, 23:31:59)
[GCC Apple cpp-p ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a=10
>>> a = "abc"
>>> a = [1, 2, 3, 4]
>>>
Variable names are case sensitive
A = 10
a = 10 ## two variables with value 10
胞涩占碳绒抑菏局褂狂嚎权躲抖试烘矛妮横染枪阳剁孕故寅钙邹菊址次丧Python languagePython language
Built-in Primitive types
Integers
Strings; “abc”, ‘abc’, ‘’(empty string)
immutable
Long integers (unlimited size); a = 1000L
booleans (Python )
floating plex numbers; 3+4j
楷抄浙加诈湖勉匀羞状司浓殿烩湍藩汝盲书怯稻爆叠篙视撂纳晶恰砖邻性Python languagePython language
String Operations
+ (concatenate)
* (repeat)
[i] (index)
Indices start at 0; negative indices