潘振中
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 期中考前的幾個Python必懂重點 ###### tags: `期中` `Python` `蟒蛇` `可怕的大蟒蛇` `panic` `frustrated` ## 前言 下一篇:<a href="https://hackmd.io/n84QsEMuRuaWDusXw83s8w">期末考前的幾個Python必懂重點</a><br /> <font color="#FF2D2D">紅色</font>是重點 <<font color="#2CBFE0 ">藍色</font>>是讓你變動的東西 歡迎分享,代碼推薦上編譯器實際體驗一次 有問題能在下面提問 這裡只是我考試或寫作業時覺得很常用的重點整理 詳細資料請參閱 <a href="https://letranger.github.io/PythonCourse/PythonBasic.html" target="_blank">Python教材PDF</a><br /> ## 宣告 ### 數字類 #### <font color="#FF2D2D">整數</font> 語法如下: <<font color="#2CBFE0 ">變數名稱</font>> = <<font color="#2CBFE0 ">任意整數</font>> > <font color="#00CC00">即興範例</font> ``` a = 10 #自動識別為整數類型 b = 10.01 #b為小數類型 b = int(b) #轉換數字類型(無條件捨去) ``` #### <font color="#FF2D2D">浮點數(小數)</font> 語法如下: <<font color="#2CBFE0 ">變數名稱</font>> = <<font color="#2CBFE0 ">任意小數</font>> > <font color="#00CC00">即興範例</font> ``` a = 10.4 #自動識別為小數類型 b = 10 #b為整數類型 b = float(b) #轉換成小數類型(雖然是整數,但本質是小數類型) ``` #### 二進位轉十進位 語法如下: <<font color="#2CBFE0 ">十進位變數名稱</font>> =int(<<font color="#2CBFE0 ">二進位值</font>>,2) > <font color="#00CC00">3E.py</font> > 輸入: 一個8個位元的二進位字串 > 輸出: 相對應的10進位值 ``` A =input() B =int(A,2) print('二進位數 {0} 在十進位表達為: {1}.'.format(A,B)) ``` ### <font color ="#FF2D2D">運算</font> 加法 <<font color="#2CBFE0 ">變數1</font>>+<<font color="#2CBFE0 ">變數2</font>> 減法 <<font color="#2CBFE0 ">變數1</font>>-<<font color="#2CBFE0 ">變數2</font>> 乘法 <<font color="#2CBFE0 ">變數1</font>>*<<font color="#2CBFE0 ">變數2</font>> 除法  <font color="#8F8F8F">#除以0會報錯</font> <<font color="#2CBFE0 ">變數1</font>>/<<font color="#2CBFE0 ">變數2</font>> 向下取整除法 <<font color="#2CBFE0 ">變數1</font>>//<<font color="#2CBFE0 ">變數2</font>> 絕對值 abs(<<font color="#2CBFE0 ">變數</font>>) <font color ="#FF2D2D">模(整數運算取餘數)</font> <<font color="#2CBFE0 ">變數1</font>>%<<font color="#2CBFE0 ">變數2</font>> 模運算最重要的就是在奇數、偶數、因數與質數的判斷 請務必了解 > <font color="#00CC00">奇偶判斷</font> ``` number = int(input()) if number % 2 == 0 #除以2餘0(整除於2) print('偶數') elif number % 2 == 1 #除以2於1 print('奇數') ``` <font color="#FF2D2D">指數運算</font> <<font color="#2CBFE0">底數變數</font>>\*\*<<font color="#2CBFE0">指數變數</font>> 這樣你就不用import math用sqrt了 > <font color="#00CC00">開根號</font> ``` number = int(input()) print('sqrt is {0:.2f}'.format(number**0.5)) ``` ### 布林值 #### <font color="#FF2D2D">布林值</font> 語法如下(注意大小寫): <<font color="#2CBFE0 ">布林名稱</font>> = True <<font color="#2CBFE0 ">布林名稱</font>> = False > <font color="#00CC00">"簡易"質數判斷</font> ``` number = int(input()) #輸入一個數number n_prime = False #number預設是質數 for i in range(2,number): #i範圍從2到number-1 if number%i == 0: #如果number有任何因數 n_prime = True break if n_prime == True: #如果布林值結果為正 print('not prime') #輸出"非質數" else: print('prime') ``` ## 輸出print ### print #### <font color="#FF2D2D">就是print</font> 語法如下: print(<<font color="#2CBFE0 ">能print的都行</font>>) 一些特別的語法: 把尾段換行取代以<字串>結尾 print(<<font color="#2CBFE0 ">能print的都行</font>>,end ='<<font color="#2CBFE0 ">字串</font>>') > <font color="#00CC00">即興範例</font> ``` print('Hello world') #字串要用'Hi'或''Hi''框起來 a = 10 print(a) ``` #### <font color="#FF2D2D">格式化print</font> 語法如下: print('{<<font color="#2CBFE0 ">第0項</font>>}裡面的字串{<<font color="#2CBFE0 ">第1項</font>>}'.format(<<font color="#2CBFE0 ">變數1</font>>,<<font color="#2CBFE0 ">變數2</font>>)) 考試的大重點 **目前主要功能是小數點位數輸出** 語法如下: <font size=2>print('{<<font color="#2CBFE0 ">第0項</font>>},{<<font color="#2CBFE0 ">第1項</font>>:.<<font color="#2CBFE0 ">取到小數點第幾位</font>>f}'.format(<<font color="#2CBFE0 ">變數1</font>>,<<font color="#2CBFE0 ">變數2</font>>))</font><br> > <font color="#00CC00">1B.py</font> > 輸入圓柱體的的半徑、高 ,輸出該圓柱體體積。 > 請以小數計算,輸出至第四位,pi的值請計算至3.1416。 ``` r = float(input()) #宣告半徑 h = float(input()) #宣告高 print('{0:.4f}'.format(r**2*3.1416*h)) #注意{}中的格式表達 ``` ## input/特殊測資要求 ### input #### <font color="#FF2D2D">input</font> 語法如下: <<font color="#2CBFE0 ">變數名稱</font>> = input() 考試用不到的用法 <<font color="#2CBFE0 ">變數名稱</font>> = input('請輸入數字')  <font color="#8F8F8F">#在終端機會出現提示字</font> 考試很重要但不是必要的用法 <<font color="#2CBFE0 ">變數名稱</font>> = int(input()) <<font color="#2CBFE0 ">變數名稱</font>> = float(input()) <<font color="#2CBFE0 ">變數名稱1</font>>,<<font color="#2CBFE0 ">變數名稱2</font>> = input().split()  <font color="#8F8F8F">#同行輸入</font> <<font color="#2CBFE0 ">變數名稱1</font>>,<<font color="#2CBFE0 ">變數名稱2</font>> = map(int,input().split())<font color="#8F8F8F">  #同行輸入轉int</font> ### try except #### try except 語法如下: try: <<font color="#2CBFE0 ">function(一個函式)</font>> except:   <font color="#8F8F8F">#如果前項函式無法執行(ERROR)時</font> <<font color="#2CBFE0 ">function</font>> else:     <font color="#8F8F8F">#except無執行時</font> <<font color="#2CBFE0 ">function</font>> > <font color="#00CC00">2B.py</font> >請撰寫一程式讀入某生姓名、各科成績,以特定格式輸出結果。 輸入:姓名、2科成績,所有輸出資料都在同列,以空白相隔。 輸出:姓名及平均(至小數點第4位,:後有一英文空白)。 因為輸入值可能會出現錯誤,例如分數輸入9a, 8b之類的,造成無法計算,若出現此類問題,請輸出Error!! ``` a = input().split() try: for i in range(1,3): a[i] = float(a[i]) #嘗試把後兩位字串轉成浮點數 except: #其中之一轉不了,把它抓出來 print('Score {0} error!!'.format(i)) else: #沒出啥差錯,輸出成績 print('{0}: {1:.4f}'.format(a[0],sum(a[1:3])/2)) ``` ### <font color="#FF2D2D">多測資輸入</font> **這個你不會遇到這種的你就沒了** 所以至少把它背起來,最好的就是理解EOF(End of file)Error還有try except的用法 > <font color="#00CC00">zerojudge_a007(質數判斷).py</font> > 請判斷某數是否為質數 輸入說明 輸入有多組測試資料(以EOF結尾),每組測試資料占一行,只包含一個整數x, 2 ≦ x ≦ 2147483647。 > 測試資料至多有200000筆。 > 輸出說明 > 對於每組測試資料,如果輸入的x為質數,則輸出一行「質數」(不含引號);否則輸出一行「非質數」(不含引號)。詳見範例測試資料。 ``` #這個寫法在zerojudge超時(TLE)了但可以正常使用 P = True try: while True: a = int(input()) if a%2 == 0: print('非質數') P = False else: for i in range(3,int(a**(1/2)),2): if a%i == 0: print('非質數') P = False if P == True: print('質數') except: pass #資料結束,程式以pass結束 ``` ## 判斷結構 ### 條件判斷 #### <font color="#FF2D2D">關係運算子</font> 語法如下: <<font color="#2CBFE0 ">變數1</font>> == <<font color="#2CBFE0 ">變數2</font>> <<font color="#2CBFE0 ">變數1</font>> != <<font color="#2CBFE0 ">變數2</font>> or <<font color="#2CBFE0 ">變數1</font>> not <<font color="#2CBFE0 ">變數2</font>> <<font color="#2CBFE0 ">變數1</font>> > <<font color="#2CBFE0 ">變數2</font>> <<font color="#2CBFE0 ">變數1</font>> < <<font color="#2CBFE0 ">變數2</font>> <<font color="#2CBFE0 ">變數1</font>> >= <<font color="#2CBFE0 ">變數2</font>> <<font color="#2CBFE0 ">變數1</font>> <= <<font color="#2CBFE0 ">變數2</font>> 通常搭配 if 和 while 使用 #### 邏輯運算子 語法如下: <<font color="#2CBFE0 ">關係判斷1</font>> and <<font color="#2CBFE0 ">關係判斷2</font>> <<font color="#2CBFE0 ">關係判斷1</font>> or <<font color="#2CBFE0 ">關係判斷2</font>> not <<font color="#2CBFE0 ">關係判斷</font>> #### <font color="#FF2D2D">if...elif...else</font> 語法如下: if <<font color="#2CBFE0 ">關係判斷1</font>>:   <<font color="#2CBFE0 ">function</font>> elif <<font color="#2CBFE0 ">關係判斷2</font>>:   <<font color="#2CBFE0 ">function</font>> else:   <<font color="#2CBFE0 ">function</font>> > <font color="#00CC00">4A.py</font> ``` num =int(input()) if num < 0: print('M') elif num == 0: print('Z') elif num%2 == 0: print('E') elif num%2 == 1: print('O') ``` ## 迴圈Loop ### for #### <font color="#FF2D2D">for loop</font> 語法如下: for <<font color="#2CBFE0 ">function</font>>:   <<font color="#2CBFE0 ">function</font>> range用法: <font size = 2>for <<font color="#2CBFE0 ">局域變數名稱</font>> in range(<<font color="#2CBFE0 ">整數起始數字(預設0)</font>>,<<font color="#2CBFE0 ">整數終止數字(總共會跑到終止數字-1)</font>>,<<font color="#2CBFE0 ">整數間隔</font>>)</font> > <font color="#00CC00">即興範例</font> ``` for i in range(1,100): print('hello world {0} times'.format(i)) ``` 走訪用法: 當你有一字串或是列表時: for <<font color="#2CBFE0 ">局域變數名稱</font>> in <<font color="#2CBFE0 ">字串或列表</font>>:   <<font color="#2CBFE0 ">function</font>> > <font color="#00CC00">輸出列表或字串元素</font> ``` a_string = 'Koyori my wifu' for i in a_string: print(i,end ='') ``` 迴圈(for版)外的else: 當迴圈正常結束(非break等原因)時才會執行 > <font color="#00CC00">找最小因數</font> ``` number = int(input()) for i in range(2,number): if number%i == 0: print('找到最小因數',i) break #找到最小因數就退出迴圈 else: print('找不到因數') ``` ### while #### while 語法如下: while <<font color="#2CBFE0 ">關係判斷</font>>:  <font color="#8F8F8F">#當判斷成立時</font>     <<font color="#2CBFE0 ">function</font>> > <font color="#00CC00">不帶根號的平方數開根號</font> ``` a_square_number = int(input()) test_number = 0 while test_number**2 != a_square_number: test_number += 1 print('sqrt is',test_number) ``` 迴圈(while版)外的else: 當迴圈正常結束(非break等原因)時才會執行 > <font color="#00CC00">找最小因數</font> ``` number = int(input()) i = 2 while number > i: if number%i == 0: print('找到最小因數',i) break #找到最小因數就退出迴圈 else: i += 1 else: print('找不到因數') ``` ### break #### <font color="#FF2D2D">break 跳出迴圈</font> 語法如下: while 或是 for:   break > <font color="#00CC00">找最小因數</font> ``` number = int(input()) for i in range(2,number): if number%i == 0: print('找到最小因數',i) break #找到最小因數就退出迴圈 else: print('找不到因數') ``` ### 巢狀迴圈 #### <font color="#FF2D2D">迴圈堆疊</font> for <<font color="#2CBFE0 ">局域變數名稱1</font>> in <<font color="#2CBFE0 ">字串或列表或range</font>>:   for <<font color="#2CBFE0 ">局域變數名稱</font>> in <<font color="#2CBFE0 ">字串或列表或range</font>>:     <<font color="#2CBFE0 ">function</font>> 不囉嗦直接上範例 > <font color="#00CC00">168_又見沙漏</font> > 題目敘述 > 就是要沙漏圖形... > 輸入說明 > 一個正整數0<n<20 > 輸出說明 > 請參考輸出範例 > 輸入範例1 > 4 > 輸出範例1 > @@@@@@@ >  @@@@@ >   @@@ >    @ >    @ >   @@@ >  @@@@@ > @@@@@@@ ``` n = int(input()) for i in range(n): for q in range(i): print(' ',end = '') for j in range(2*n-1-i*2): print('@',end = '') print() for i in range(n): for j in range(n-1-i): print(' ',end = '') for q in range(2*i+1): print('@',end= '') print() ``` ## 陣列List ### 一維list #### <font color="#FF2D2D">一維list宣告及基本用法</font> 宣告語法如下: <<font color="#2CBFE0 ">陣列名稱</font>> = [<<font color="#2CBFE0 ">物件1</font>>,<<font color="#2CBFE0 ">物件2</font>>,...] 較酷的宣告法: <<font color="#2CBFE0 ">陣列名稱</font>> = [<<font color="#2CBFE0 ">物件</font>>]*<<font color="#2CBFE0 ">數量</font>> <<font color="#2CBFE0 ">陣列名稱</font>> = [<<font color="#2CBFE0 ">局域變數</font>> for <<font color="#2CBFE0 ">局域變數</font>> in range(<<font color="#2CBFE0 ">整數變數</font>>)] <<font color="#2CBFE0 ">陣列名稱</font>> = [<<font color="#2CBFE0 ">局域變數</font>> for <<font color="#2CBFE0 ">局域變數</font>> in range(<<font color="#2CBFE0 ">整數變數</font>>) if <<font color="#2CBFE0 ">關係判斷</font>>] > <font color="#00CC00">即興範例</font> ``` array1 = [1,2,3,4,5,6] array2 = [a for a in range(1,7)] array3 = [a for a in range(10) if a <=6 and a>0] print('{0} = {1} = {2}'.format(array1,array2,array3)) #三個list的值是一樣的 ``` #### <font color="#FF2D2D">list相關重要函式</font> len(<<font color="#2CBFE0 ">list</font>>)  <font color="#8F8F8F">#返回List長度</font> list(<<font color="#2CBFE0 ">str</font>>)   <font color="#8F8F8F">#將<str>轉成list</font> <<font color="#2CBFE0 ">list</font>>.clear()  <font color="#8F8F8F">#清空list</font> <<font color="#2CBFE0 ">list</font>>.append(<<font color="#2CBFE0 ">物件</font>>)   <font color="#8F8F8F">#將<物件>加入list尾端</font> <<font color="#2CBFE0 ">list1</font>>.extend(<<font color="#2CBFE0 ">list2</font>>)   <font color="#8F8F8F"> #將<list2>合併至<List1>尾端</font> <<font color="#2CBFE0 ">list</font>>.remove(<<font color="#2CBFE0 ">物件</font>>)   <font color="#8F8F8F">#移除<list>中<obj>元素</font> <<font color="#2CBFE0 ">list</font>>.insert(<<font color="#2CBFE0 ">位置</font>>,<<font color="#2CBFE0 ">物件</font>>) <font color="#8F8F8F">#將\<obj\>加到\<List\>的索引值\<i\>位置\<list\>中\<obj\>元素</font> 詳細及更多內容請參閱<a href="https://letranger.github.io/PythonCourse/PythonBasic.html#org1764abb" target="_blank">Python教材PDF</a><br /> ### 二維list 宣告語法如下: <<font color="#2CBFE0 ">陣列名稱</font>> = [[<<font color="#2CBFE0 ">物件</font>>]*<<font color="#2CBFE0 ">行數</font>> for _ in range(<<font color="#2CBFE0 ">列數</font>>)] > <font color="#00CC00">即興範例</font> ``` arr1 = [[0]*5 for _ in range(3)] #3*5二維陣列 5行3列 print(arr1) ``` > <font color="#00CC00">7G_Drunk_cockroach.py</font> > 程式要求說明 > 403教室裡住著一隻蟑螂,某日,403常駐工友將這隻蟑螂灌醉,然後隨意丟到地板讓它亂走 > (敘述省略) > 請列出在蟑螂非志願飛出窗外後,所有地板被踩次數旳總和 ``` m,n = map(int,input().split()) floor = [[0]*n for i in range(m)] #n行m列 y,x = map(int,input().split()) floor[y][x] = 1 command = list(map(int,input().split())) stop = False for i in range(len(command)): <主程式省略> step = 0 for i in range(m): step += sum(floor[i]) print(step) ``` ## 版主典藏好用代碼 ### 資料分析 #### numpy ``` import numpy numpy.std(list) #標準差 numpy.sum(list) #總和 numpy.average(list) #平均 ``` ### 一行解/快速寫法系列 #### 宣告時利用if ``` grade = [10,30,50,40,70,80,60,40,20,10] Pass = [i for i in grade if i >= 60] #只抓條件內的元素作為新陣列 print(Pass) ``` #### <font color="#FF2D2D">map映射</font> map會把後方序列的每一個元素調用function,並映射到指定的列表中 語法如下: <<font color="#2CBFE0 ">a,b,c...</font>> = map(<<font color="#2CBFE0 ">function</font>>,<<font color="#2CBFE0 ">變數1</font>>,<<font color="#2CBFE0 ">變數2</font>>,...) ``` a,b,c = map(int,input().split()) #單行空格輸入的方法 grade = list(map(int,input().split())) #把input個別轉換成int後做成list丟給grade ``` #### 邪門lambda 極簡主義者 有時連自己都讀不懂 沒事不要用 <font size=2><font color="#8F8F8F">#某知名籃球社免修電神對lambda的評價</font></font> ![](https://i.imgur.com/We5j5Dn.png =50%x) > <font color="#00CC00">輸入輸出總和一行解</font> ``` (lambda array:print(sum(array)))(list(map(int,input().split()))) ``` > <font color="#00CC00">輸入輸出平方和一行解</font> ``` print(sum(list(map(lambda num:num**2,list(map(int,(input().split()))))))) ``` > <font color="#00CC00">輸入輸出標準差無numpy一行解</font> > <font color="#8F8F8F">(籃球社電神提供)</font> ``` print((lambda x:'{0:0.3f}'.format((sum(map(lambda y:y**2,x))/len(x)-(sum(x)/len(x))**2)**(1/2)))(list(map(int,input().split())))) ``` ### 方便類 #### sort 同時sort又翻轉 ``` grade = [10,40,50,30,20,60,90] grade.sort() #排列(由小到大) print(grade) grade = [10,40,50,30,20,60,90] grade.sort(reverse = True) #同時排列和反轉(最後為由大到小) print(grade) ``` #### 嗚嗚嗚我要print我的陣列可是我又不想print出中括號但是要用迴圈去走訪好麻煩嗚嗚嗚 list前面加一個\*號就好了 <font size="1"><font color="#FF2D2D">#就個人經驗,某些評分系統裡可能會失效(WA),這時候別be panic然後乖乖做走訪</font></font> ``` array = [1,2,3,4,5,6] print(*array) #print list without [] ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    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.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully