Learning with python: Chapter2 Variables, expressions and statements
来源:互联网 发布:powermill10.0编程步骤 编辑:程序博客网 时间:2024/06/03 19:02
20个关键词:
and def exec if not return assert del finally import or try break elif for in pass while class else from is print yield continue except global lambda raise
[root@CentOS python]# python
Python 2.6.6 (r266:84292, Feb 21 2013, 23:54:59)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 4 # use print
4
>>> type("Hello world!") # use type()
<type 'str'>
>>> type(3.2)
<type 'float'>
>>> print 1,000,000 # use , operator printmulti-variables
1 0 0
>>> Message="What's up?" # string
>>> n=17
>>> pi=3.1415926
>>> print Message # print string
What's up?
>>> print n
17
>>> print pi
3.1415926
>>> type(Message),type(n),type(pi)
(<type 'str'>, <type 'int'>, <type 'float'>)
>>> 1+1
2
>>> 17
17
>>> Message # string, compare with "print string"
"What's up?"
>>> 5**2,4*3 # ** is exponent and * is multiply
(25, 12)
>>> minute=59
>>> minute/60 # round off
0
>>> minute*100/60
98
>>> 3*1**3 # ** is prior to *
3
>>> (3*1)**3
27
>>> print Message + "Ted." # operate string
What's up?Ted.
>>> print Message*3 # print Message for 3 times
What's up?What's up?What's up?
>>> percentage=(minute*100)//60 # // is same as / as a division operator
>>> percentage
98
>>> percentage=(minute*100)/60
>>> percentage
98
- Learning with python: Chapter2 Variables, expressions and statements
- Think Python:Chapter 2:Variables(变量), expressions(表达式) and statements(陈述) 的笔记
- Arithmetic: Creating Expressions With Variables And Operators
- Expressions, and Prints-Learning Python-Chapter 11
- Statements and Declarations in Expressions
- Chapter 3 - Variables and Expressions
- chapter2 of OReilly.Hands-On.Machine.Learning.with.Scikit-Learn.and.TensorFlow
- 【Mastering Machine Learning with scikit-learn (python+spark版)】Chapter2 Linear Regression
- Learning .NET Regular Expressions with Expresso
- Machine Learning:Linear Regression With Multiple Variables
- Machine Learning - Linear Regression with Multiple Variables
- Machine Learning:Regression with multi variables
- Introducing Python Statements---Learning Python Chapter10
- learning puppet 2--Variables and Facts
- Beginning Python - Chapter2 : Lists and Tuples
- Python en:Operators and Expressions
- Global and Local Variables python
- Learning with python: Chapter3~4 Functions,Conditionals and Recursion
- 一个帖子学会Android开发四大组件(转载)
- 系统集成项目管理之项目收尾管理
- 浅谈C/C++中运算符的优先级、运算符的结合性以及操作数的求值顺序
- 抽象类的使用
- 《深入理解Nginx》阅读与实践(一):Nginx安装配置与HelloWorld
- Learning with python: Chapter2 Variables, expressions and statements
- C中在函数中定义函数(二)
- HDU3509(构造矩阵)
- HDU 4666 Hyperspace
- 使用AsyncTask异步更新UI界面及原理分析
- Open vSwitch使用笔记
- 【Python排序搜索基本算法】之Dijkstra最短路径算法(Dijkstra's Shortest-Path Algorithm)
- Qt小笔记
- Set集合容器