第一章 python基础
一.python 不用定义变量类型,不用分号分开语句,直接分行
二. round()
1.连续输入多行round(),最后只输出最后一行
2.round()不改变原值
三. Strings
-
"\保护字符串中的引号
-
“r“ 在字符串前输入r 可以避免将斜杠\作为特殊符号
-
"…"连接两行 或者”\“
四.lists
- 当数据量很大时,可以直接读取文件,再将内容存储到list中
2.loop : let computer repeat the same work
——for some_variable in some_list:
( for in : for语句后有冒号,另行需要缩进tab)
五.dictionary
2.可查找字典中是否有指定的key
六. function
1.create a simple function and use it
2.参数传递
substract( a = 10,b=7) 和 substract(b = 7,a = 10) 一样
substract( 10 , 7) 和 substract( 7 , 10)不一样
3. default arguments
.
- One function but different methods
- output two different answers using two methods, using comma to separate