python
a=7 ; a為名稱(name) 或是 識別字(identifier),7為物件
1.英文字母大小寫az,AZ 數字0~9 底線 _。
2.第一個字不能是數字。
3.區分大小寫。
4.保留字(reserved word)與關鍵字(keyword)不能使用。
2.x有31個,3.x有33個
and,as,assert,break,class,continue,def,del,elif,else,except,exec(2.x),finally
for,from global,if,import,in,is,lambda,nonlocal(3.x),not,or,pass,print(2.x),raise
return,try,while,with,yield,None(3.x),False(3.x),True(3.x)
別名(alias):共享參考(shared reference)
別名範例1:
a=3
b=a ->a,b都指向同一物件。
別名範例2:
a=[3,1,6]
b=a
b[0]=8 ->則a 也會變成[8,1,6] 使用可變物件,要小心別名現象。都可透過別名修改物件。
list[串列]:可以放任何物件,使用[] 建立。
li = ['ytc',316]
li[0] –>'ytc' 0為索引,由0開始
li[0]='lowina' –>變成lowina
li =['ytc',316,['lowina',825]]–>li[2][0] 是 'lowina'
tuple(元組):就是不可變的list,使用() 建立。
S20200515
M20200528 add tag
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing