Python_1
来源:互联网 发布:java时间格式化年月日 编辑:程序博客网 时间:2024/06/10 12:05
Python_1 code_cademy
1. Indentation 指的是缩进,空格。 比如for循环下的缩进格数,一直到return结束。
python 中缩进格数可以为2(code_cademy), 也可以为4。在pycharm中为4个,一个程序中使用的空格数量应该相同。
2. 在数学运算中,指数运算使用 ** , 指数运算是 **,不是 ^ 。
eg:
# Set eggs equal to 100 using exponentiation on line 3!
eggs = 10 ** 2
# Write your code above!
print eggs
3. 一行的注释使用 #.
多行的文本注释使用三个上引号:""" 就像这样子 """
4. Modulo:Modulo returns the remainder from a division. So, if you type
3 % 2
, it will return 1
, because 2 goes into 3 evenly once, with 1 left over. 使用的符号为 %
5. syntax 句法, python syntax:python 的句法
6. x = "False", x 是string类型,不是boolean类型
7. python 中 15/100 得零,大概是因为两个数都是整数。想要得到小数形式,应该:15.0/100
阅读全文
0 0
- python_1
- Python_1
- python_1
- Python_1
- Python_1
- python_1(基础知识)
- python_1(对象,变量名,函数,分隔符,换行)
- metrics小常识
- Bayesian(贝叶斯)
- 分布式系统和集中式系统概念的简单易懂理解
- hdu 1546 Idiomatic Phrases Game (SPFA或者Dijkstra)
- paintEvent()的使用和触发
- Python_1
- construct2,游戏制作终结者
- unity设置游戏帧率
- ReactNative基础(五)使用react-navigation实现页面的跳转、参数的传递(StackNavigator)
- 二、Spark性能优化:资源调优篇
- 监控利器 sysdig
- 游戏设计模式--状态机模式(翻译整理)(下篇)
- 51 nod 1201 整数划分(dp)
- cudnn6.0的安装简单教程