2018年8月26日 星期日

電動機車的牌照分類表格

電動機車的牌照分類表格

種類
大型重型
大型重型
普通重型
普通輕型
小型輕型
電動自行車
電動(輔助)自行車
馬力
馬力>54
550CC
馬力>40
5<馬力<40
1.34<馬力<5
馬力<1.34

時速
時速>45公里
時速<45公里
時速<25公里
車重
70公斤以下
40公斤以下
掛牌
須掛牌
須掛牌
須掛牌
須掛牌
須掛牌
免掛牌
安全帽
駕照
乘車人數
2
2
2
2
1
1
車牌
紅底白字
黃底黑字
白底黑字
綠底白字
白底紅字

車牌的顏色分類與目前的一般汽油機車是一樣的,只是新掛牌的,加了「電動車」的字樣。車牌英文編碼統一為“E”開頭,並加註「電動車」字樣。自2018年1月1日起,新辦領牌的電動機車,均會掛上這類新式牌照。

來源:
交通部公路總局

電動輔助自行車相關法規

2018年8月25日 星期六

[python]練習一:猜數字

# Python 3

import random

number = random.randrange(1, 100)

while 1==1:
    guess = int(input("Guess a number(1~100):"))

    if guess == number:
        print ("Great! You win!")
        break

    elif guess < number:
        print ("Too small!")

    else:
        print ("Too big!")
 # Python 3

import random

number = random.randrange(1, 100)

while 1==1:
    guess = int(input("Guess a number(1~100):"))

    if guess == number:
        print ("Great! You win!")
        break

    elif guess < number:
        print ("Too small!")

    else:
        print ("Too big!")

 

[python] 將python包裝為執行檔(compile python to EXE file)

Anaconda 是python 的 distribution 包含超過1000以上的package,可以用pip指令來安裝一些package、API等等來使用。

pip install pyinstaller
pyinstaller -F ./hello.py #可以將 hello.py轉成windows下的執行檔。

packages as follows:

Py2exe

PyInstaller

cx_Freeze

bbfreeze

py2app

ref:
http://www.freehackers.org/Packaging_a_python_program

2018年8月24日 星期五

[python] 流程、迴圈 (2)

#if elif else GUESS Number 猜數字
num = 7
gnum = input()
if int(gnum) == num:
    print('You are Right!!!')
elif int(gnum) > num:
    print('smaller')
else:
    print('bigger')

# While LOOP 猜數字
num = 7
# gnum =0
print ("Key in A number to Guess=")
while 1!=0: #while True:
    gnum = input()
    if int(gnum) > num:
        print("Wrong Smaller")
    elif int(gnum) < num:
        print("Wrong Bigger")
    else:
        print("Right!!!")
        break

# FOR loop 九九乘法表
for i in range(1,10):
    for j in range(1,10):
        print (str(int(i))+'x'+str(int(j))+'='+str(int(i)*int(j)))


# For LOOP 改良九九乘法表
for i in range(1,10):
    for j in range(1,10):
        print("%d*%d=%2d" % (i,j,i*j),end="  ")
    print("")

1*1= 1  1*2= 2  1*3= 3  1*4= 4  1*5= 5  1*6= 6  1*7= 7  1*8= 8  1*9= 9  
2*1= 2  2*2= 4  2*3= 6  2*4= 8  2*5=10  2*6=12  2*7=14  2*8=16  2*9=18  
3*1= 3  3*2= 6  3*3= 9  3*4=12  3*5=15  3*6=18  3*7=21  3*8=24  3*9=27  
4*1= 4  4*2= 8  4*3=12  4*4=16  4*5=20  4*6=24  4*7=28  4*8=32  4*9=36  
5*1= 5  5*2=10  5*3=15  5*4=20  5*5=25  5*6=30  5*7=35  5*8=40  5*9=45  
6*1= 6  6*2=12  6*3=18  6*4=24  6*5=30  6*6=36  6*7=42  6*8=48  6*9=54  
7*1= 7  7*2=14  7*3=21  7*4=28  7*5=35  7*6=42  7*7=49  7*8=56  7*9=63  
8*1= 8  8*2=16  8*3=24  8*4=32  8*5=40  8*6=48  8*7=56  8*8=64  8*9=72  
9*1= 9  9*2=18  9*3=27  9*4=36  9*5=45  9*6=54  9*7=63  9*8=72  9*9=81  

# 題目:5位同學的數學成績分別為 22 38 40 52 64,將成績開根號再乘以10,並印出新成績及平均成績
math_scores=[22,38,40,52,64]
print('5位成績=',math_scores)
print('平均成績=',(math_scores[0]+math_scores[1]+math_scores[2]+math_scores[3]+math_scores[4])/5)
print('5位新成績=[',math_scores[0]**0.5*10,",",math_scores[1]**0.5*10,",",math_scores[2]**0.5*10,",",math_scores[3]**0.5*10,",",math_scores[4]**0.5*10,"]")
print('平均新成績=',(math_scores[0]**0.5*10+math_scores[1]**0.5*10+math_scores[2]**0.5*10+math_scores[3]**0.5*10+math_scores[4]**0.5*10)/5)

math_scores=[22,38,40,52,64]
print('5位成績=',end=" ")
for score in math_scores:
    print(score,end="  ")
print("\n")
print ("平均成績=",sum(math_scores)/len(math_scores),"\n")
print('5位新成績=',end=" ")
for i in range(len(math_scores)):
    math_scores[i]=math_scores[i]**0.5*10
    print(math_scores[i],end=" ")
print("\n")
print ("平均成績=",sum(math_scores)/len(math_scores),"\n")

載 html py ipynb原始檔

[python] 基本輸出入及運算子操作 (1)

example:
#輸出
print("hello python!!!")
print('hello python!!!')
print (3+5)
print ("python "*5) #重覆列印
print ('python'+str(3+int('3')))
print (12%5)  #餘數
print (18//5)   #商

#輸入
a=input()
print(a)

#匯入時間模組
import time
print(time.localtime())

#python 列表(比陣列更有彈性)
list_data = [1,'yoloeasylife',4.3,[45,67,89]]
print (list_data)                 # 輸出完整的list
print (list_data[0])             # 輸出第一個元素
print (list_data[1:3])          # 輸出第二個到第三個個元素
print (list_data[1:])            # 輸出第二個到最後一個元素
print (list_data[3][1])         # 輸出67
print (list_data.index('yoloeasylife')) #輸出yoloeasylife的index
list_data.append('hello')        #添加資料
print (list_data)
list_data.insert(1,'python')    #插入資料
print (list_data)
list_data.remove('hello')       #刪除資料
print (list_data)
mynumber=[1,5,7,3,6,9,23,11]
mynumber.sort()                  #排序
print (mynumber)

#python Dictionary              #字典庫
mydata =  {'name': 'doris','country':'taiwan', 'hobby': 'dance'}
mydata['name']
mydata.keys()
mydata.values()

#python 邏輯運算
print('1',13 == 8)
print('3',13 != 8)
print('5',13 < 0)
print('7',13 <= 2)
print('9','yolo' == 'yolo')
print('11','yolo'== 'YOLO')
print('13',(3<4) and (4>5))
print('15',(3<4) or (4>5))
print('17',not (3<4) )

載 html py ipynb原始檔

[python] 開始使用 jupyter& jupyter的快捷鍵


1. 命令列中執行 jupyter notebook
 可修改port number:   jupyter notebook --port 9999

2.使用快捷鍵(命令模式按H)

Enter : 編輯模式

Shift-Enter : 執行本單元,選中下個單元
Ctrl-Enter : 執行本單元
Alt-Enter : 執行本單元,在其下插入新單元
Y : 單元轉入程式碼狀態
M :單元轉入markdown狀態
R : 單元轉入raw狀態
A : 在上方插入新單元
B : 在下方插入新單元
X : 剪下選中的單元
C : 複製選中的單元
Shift-V : 貼上到上方單元
V : 貼上到下方單元
D,D : 刪除選中的單元
Shift-M : 合併選中的單元
Ctrl-S : 文件存檔
S : 文件存檔
1 : 設定 1 級標題
2 : 設定 2 級標題
3 : 設定 3 級標題
4 : 設定 4 級標題
5 : 設定 5 級標題
6 : 設定 6 級標題
Tab : 程式碼補全或縮排
Shift-Tab : 提示
Ctrl-] : 縮排
Ctrl-[ : 解除縮排
Ctrl-A : 全選
Ctrl-Z : 復原
Ctrl-Shift-Z : 再做
Ctrl-Y : 再做
Ctrl-Home : 跳到單元開頭
Ctrl-End : 跳到單元末尾


Esc : 進入命令模式
Ctrl-M : 進入命令模式
Shift-Enter : 執行本單元,選中下一單元
Ctrl-Enter : 執行本單元
Alt-Enter : 執行本單元,在下面插入一單元
Ctrl-Shift-- : 分割單元
Ctrl-Shift-Subtract : 分割單元
Ctrl-S : 文件存檔
Shift : 忽略
Up : 游標上移或轉入上一單元
Down :游標下移或轉入下一單元

H : 顯示快捷鍵幫助(最重要)

Command Mode (press Esc to enable)

F: find and replace
Ctrl-Shift-F: open the command palette
Ctrl-Shift-P: open the command palette
Enter: enter edit mode
P: open the command palette
Shift-Enter: run cell, select below
Ctrl-Enter: run selected cells
Alt-Enter: run cell and insert below
Y: change cell to code
M: change cell to markdown
R: change cell to raw
1: change cell to heading 1
2: change cell to heading 2
3: change cell to heading 3
4: change cell to heading 4
5: change cell to heading 5
6: change cell to heading 6
K: select cell above
Up: select cell above
Down: select cell below
J: select cell below
Shift-K: extend selected cells above
Shift-Up: extend selected cells above
Shift-Down: extend selected cells below
Shift-J: extend selected cells below
A: insert cell above
B: insert cell below
X: cut selected cells
C: copy selected cells
Shift-V: paste cells above
V: paste cells below
Z: undo cell deletion
D,D: delete selected cells
Shift-M: merge selected cells, or current cell with cell below if only one cell is selected
Ctrl-S: Save and Checkpoint
S: Save and Checkpoint
L: toggle line numbers
O: toggle output of selected cells
Shift-O: toggle output scrolling of selected cells
H: show keyboard shortcuts
I,I: interrupt the kernel
0,0: restart the kernel (with dialog)
Esc: close the pager
Q: close the pager
Shift-L: toggles line numbers in all cells, and persist the setting
Shift-Space: scroll notebook up
Space: scroll notebook down

Edit Mode (press Enter to enable)

Tab: code completion or indent
Shift-Tab: tooltip
Ctrl-]: indent
Ctrl-[: dedent
Ctrl-A: select all
Ctrl-Z: undo
Ctrl-/: comment
Ctrl-D: delete whole line
Ctrl-U: undo selection
Insert: toggle overwrite flag
Ctrl-Home: go to cell start
Ctrl-Up: go to cell start
Ctrl-End: go to cell end
Ctrl-Down: go to cell end
Ctrl-Left: go one word left
Ctrl-Right: go one word right
Ctrl-Backspace: delete word before
Ctrl-Delete: delete word after
Ctrl-Y: redo
Alt-U: redo selection
Ctrl-M: enter command mode
Ctrl-Shift-F: open the command palette
Ctrl-Shift-P: open the command palette
Esc: enter command mode
Shift-Enter: run cell, select below
Ctrl-Enter: run selected cells
Alt-Enter: run cell and insert below
Ctrl-Shift-Minus: split cell at cursor
Ctrl-S: Save and Checkpoint
Down: move cursor down
Up: move cursor up


熱門文章