顯示具有 python 標籤的文章。 顯示所有文章
顯示具有 python 標籤的文章。 顯示所有文章

2025年6月23日 星期一

[python] 從零開始,輕鬆玩轉 Python:超詳盡影音學習資源地圖!

 

🚀 從零開始,輕鬆玩轉 Python:超詳盡影音學習資源地圖!🚀

你是否對程式設計躍躍欲試,卻不知從何下手?你是否聽聞 Python 的強大與簡潔,卻苦於找不到系統化的學習資源?別擔心!身為一位在宜蘭羅東享受生活、熱愛分享的筆者,今天要為大家獻上一份熱騰騰的 Python 學習寶藏——一份超詳盡的影音學習資源地圖!

在這個數位時代,影音學習無疑是最直觀、最易懂的方式之一。我們精心整理了一系列由淺入深的 Python 教學影片,涵蓋了從環境搭建到進階應用的各個環節。無論你是程式新手,還是希望精進 Python 技能的開發者,都能在這裡找到適合自己的學習路徑。

讓我們一起展開這趟精彩的 Python 探索之旅吧!


🛠️ 第一站:搭建你的 Python 開發環境 🛠️

工欲善其事,必先利其器。學習 Python 的第一步,就是搭建好你的開發環境。不用擔心過程複雜,我們為你準備了各平台的詳細安裝教學:

Python 基礎安裝

PyCharm 開發工具


💡 第二站:Python 語法基礎入門 💡

環境搭建完成後,讓我們開始探索 Python 的基本語法,你會發現它出乎意料的簡潔與優雅:


🧱 第三站:掌握 Python 的資料結構與控制流程 🧱

學會基本語法後,接下來我們要學習如何組織和管理資料,以及控制程式的執行流程:

資料結構

控制結構


⚙️ 第四站:運用函數與模組提高效率 ⚙️

函數和模組是 Python 強大的基石,能幫助你寫出更簡潔、可重用的程式碼:

函數


🏢 第五站:邁向物件導向程式設計 (OOP) 🏢

物件導向是現代程式設計的重要範 paradigm,Python 也提供了完善的 OOP 支持:

類別

繼承


🛡️ 第六站:處理程式中的異常與錯誤 🛡️

編寫程式難免遇到錯誤,學習如何處理這些異常情況,能讓你的程式更加健壯:


📊 最終站:用 Matplotlib 視覺化你的數據 📊

Python 在數據分析和科學計算領域有著廣泛的應用,Matplotlib 是最常用的繪圖函式庫之一:

小提醒: 學習的過程中最重要的是動手實作!跟著影片一步步操作,遇到問題不要害怕,多嘗試、多思考,你會發現 Python 比你想像的更有趣!

希望這份詳盡的 Python 影音學習資源地圖能幫助你順利踏上 Python 的學習之路。如果你在學習過程中遇到任何問題,歡迎隨時留言交流。祝你在 Python 的世界裡玩得開心!
#Python #程式設計 #學習資源 #影音教學 #入門 #進階 #資料科學 #Matplotlib

2021年2月24日 星期三

[python] 用 C 或 Python 語言進行 IRR與 XIRR 計算

參考資料:

1. https://www.itread01.com/hkpqhkxi.html

2. https://blog.csdn.net/dinghaoseu/article/details/50322117

2019年3月20日 星期三

[python] Use Python to Control the GUI(Mouse, Keyboard, etc)

Install package
under the windows environment
!pip install pyautogui

1. Control the movement of mouse
import pyautogui
for i in range(5):
   pyautogui.moveTo(0, 0, duration=0.5)
   pyautogui.moveTo(1000, 0, duration=0.5)
   pyautogui.moveTo(1000, 1000, duration=0.5)
   pyautogui.moveTo(0, 1000, duration=0.5)
2. continue....

2019年3月6日 星期三

[python] How to use Markdown in your Jupyter notebook


You can add the Markdown cell in your jupyter notebook.


1. change to markdown mode
[command mode] M

2. Number sign to format the paragraph
#
##
###

3. Asterisk sign to create the bullet list items.
*
**

4. doller sign to create the mathematical formulas(latex)

$
$$

5. Create the URL Link
[google](http://www.google.com/)

6. Insert a photo

2019年2月28日 星期四

[python] Three way to run python in your computer or mobile

One: 

Install the Anaconda in your PC https://www.anaconda.com/distribution/
Use command line: jupyter notebook

Tow:

Online python as follows:
https://repl.it/languages/python3

Three:

Google Colab https://colab.research.google.com/

You can also use ipython or qpython in your mobile.

Four:

https://thonny.org/

Python ide for beginners

[python] Learn Python NOW !!!

Python is standout in the rank of  2018 programming language. It's also the most popular languages with hackers. As a computer science teacher, we must learn the language to help students entering the world.

If you have been teaching computer science in high school for more than 20 years. You will feel that the progress of the computer is so fast. The only way is to keep on learning. It's an endless process.
Let's start to learn Python. And This note is also my learning process.

Follow the online lesson from Here  Example

2018年12月1日 星期六

[python] How to make a standalone exe file from a python(.py) file

1. install the anaconda.

2. install and upgrade
conda install -c conda-forge pyinstaller
conda install -c anaconda pywin32

3. pyinstaller --onefile <your_script_name>.py

4. Find the exefile in the Dist directory.

packages as follows:

Py2exe

PyInstaller

cx_Freeze

bbfreeze

py2app

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

2018年11月14日 星期三

[python] Lists are mutable. Intergers are immutable.


a=[1,2,3,4]
b=a
print(a is b)
b[0]='a'
print(a is b)
print(a)
print(b)


a=1
b=a
print(a is b)
b=2
print(a is b)
print(a)
print(b)

output>>
True
True
['a', 2, 3, 4]
['a', 2, 3, 4]
True
False
1
2

[python] List are mutable.


a=[1,2,3,4,5]
b=a

print(a is b)
b[0]='X'
print(a is b)
print(a,b)

output>>
True
True
['X', 2, 3, 4, 5] ['X', 2, 3, 4, 5]


lists are mutable. To use 'b=a' can create a new list easily. At the same time, it will change the value inside.

[python] How to DELETE List


x=[0,1,2,3,4,5,6,7,8,9]
x[1:2]=[]
print(x)

output:
[0, 2, 3, 4, 5, 6, 7, 8, 9]

Describe: x[start:end]

2018年10月16日 星期二

[python]python 變數宣告 global and nonlocal


def outer():
    
    def inner():
        global a
        a = 15
        print ("inner:", a)
        
    a = 10
    print("outer1:", a)
    inner()
    print("outer2:", a)

a = 5
print("main1:", a)
outer()
print("main2:", a)

output:
main1: 5
outer1: 10
inner: 15
outer2: 10
main2: 15

def outer():
    
    def inner():
        nonlocal a
        a = 15
        print ("inner:", a)
        
    a = 10
    print("outer1:", a)
    inner()
    print("outer2:", a)

a = 5
print("main1:", a)
outer()
print("main2:", a)

output:
main1: 5
outer1: 10
inner: 15
outer2: 15
main2: 5

2018年10月13日 星期六

[python] About Anaconda 的command line

已安裝套件:conda list

更新套件:
conda update 套件名稱
conda update ipython

安裝套件(建議順序):
conda install numpy
pip install numpy
easy_install numpy

建立python2.X虚擬環境
conda create -n 虚擬環境名稱 python=2* anaconda
conda create -n python27 python=2* anaconda
啟動 activate python27
查看目前虚擬環境 conda info -e
移除 conda remove -n python27 -all

ipython operation
%run python.py

2018年10月10日 星期三

[python] Change the working directory of jupyter notebook

cd directory
jupyter notebook

or
copy con startjupyter.bat
cd directory
jupyter notebook

[other way]
1. Create the working directory in any place you want in ur computer.
2. Run the Jupyter prompt or window command prompt
3. drag drop the icon of working directory to the prompt windows.( Just like Magic)

2018年9月21日 星期五

[python]串列List和常串列Tulip的練習


color_one=['red','orange','yellow','green','blue','cyan','purple']  #串列list:可新增刪除
color_two=('red','orange','yellow','green','blue','cyan','purple')  #常串列tulip:不可更改
print(color_one)
print(color_one[3])     #從0算起,取出第4個
print(color_one[2:4])   #第0算起,取出第2個到第3個
print(color_one[4:])    #取出第4個至最後
print(color_one[:5])    #取至第5個(包含第5個)
print(5*color_one[0],)  #第0個印5次
print(color_one[-1])    #最末端開始算,取第1個
print(color_one[-4:])   #最末端開始算,第4個開始取
print(color_one[1:3])   #跳步
color_one.append('black')
print(color_one.count('yellow'))
color_addcolor=['margenta','pink']
color_one.extend(color_addcolor)
del color_one[8]
print(color_one)
print(len(color_one))
print(max(color_one))
print(min(color_one))
print(color_one)
color_one.pop()
color_three=tuple(color_one)
print(color_three)


print('')
print(color_two)
print(color_two[3])     #從0算起,取出第4個
print(color_two[2:4])   #第0算起,取出第2個到第3個
print(color_two[4:])    #取出第4個至最後
print(color_two[:5])    #取至第5個(包含第5個)
print(5*color_two[0],)  #第0個印5次
print(color_two[-1])    #最末端開始算,取第1個
print(color_two[-4:])   #最末端開始算,第4個開始取
print(color_two[1:3])   #跳步
print(color_two)
color_two=list(color_two)
color_two.append('black')
print(color_two)

2018年9月20日 星期四

[python] 印出 0-100的完全平方數

定義一個 list,將出 0-100的完全平方數放入list中

squares = []
for x in range(100):
     squares.append(x**2)

print(squares)

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
   
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 
196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 
625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 
1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 
1936, 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 
2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 
3844, 3969, 4096, 4225, 4356, 4489, 4624, 4761, 4900, 
5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 
6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 
7921, 8100, 8281, 8464, 8649, 8836, 9025, 9216, 9409, 
9604, 9801]
   


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


熱門文章