--- title: 0812 內部課程上傳區 tags: 內部研習 --- <style> .navbar-brand:after { content: " × Web:AI"; } </style> > [0812 課程內容](https://hackmd.io/@webduino/0812) > [程式線上編譯環境](https://replit.com/) :::warning 繳交規範(可以複製這下面的喔) ### 自己名字 #### 函式練習 ```python # 請你設計一個簡易計算機,分別定義以下函式 # add_sum( )、sub_sum( )、mult_sum( )、div_sum( ) # 當使用者輸入兩個數 a, b 時,計算出答案 # print(add_sum(a, b)) # print(sub_sum(a, b)) # print(mult_sum(a, b)) # print(div_sum(a, b)) ``` #### 讓照片轉起來 ```python # 想一下怎麼讓照片轉起來 ``` #### 跑馬燈 ```python # 剛剛教你顯示文字了,試著結合之前的迴圈,做出跑馬燈 ``` #### 讓眼睛動起來 ```python # 試試看吧 ``` #### 讓紅綠燈動起來 ```python # 讓紅綠燈動起來 # 加入秒數 # 讓他看起來像路上的紅綠燈 ``` ::: ### 郭尚蓁 #### 函式練習 ```python # 請你設計一個簡易計算機,分別定義以下函式 # add_sum( )、sub_sum( )、mult_sum( )、div_sum( ) # 當使用者輸入兩個數 a, b 時,計算出答案 # print(add_sum(a, b)) # print(sub_sum(a, b)) # print(mult_sum(a, b)) # print(div_sum(a, b)) ``` #### 讓照片轉起來 ```python # 想一下怎麼讓照片轉起來 ``` #### 跑馬燈 ```python # 剛剛教你顯示文字了,試著結合之前的迴圈,做出跑馬燈 ``` #### 讓眼睛動起來 ```python # 試試看吧 ``` #### 讓紅綠燈動起來 ```python # 讓紅綠燈動起來 # 加入秒數 # 讓他看起來像路上的紅綠燈 ``` --- ### 徐子傑 #### 函式練習 ```python a = 1 b = 2 def add_sum(x,y): sum = x+y return sum def sub_sum(x,y): sum = x-y return sum def mult_sum(x,y): sum = x*y return sum def div_sum(x,y): sum = x/y return sum print(add_sum(a,b)) print(sub_sum(a,b)) print(mult_sum(a,b)) print(div_sum(a,b)) ``` #### 讓照片轉起來 ```python # 想一下怎麼讓照片轉起來 ``` #### 跑馬燈 ```python # 剛剛教你顯示文字了,試著結合之前的迴圈,做出跑馬燈 ``` #### 讓眼睛動起來 ```python # 試試看吧 ``` #### 讓紅綠燈動起來 ```python # 讓紅綠燈動起來 # 加入秒數 # 讓他看起來像路上的紅綠燈 ``` --- --- ### 阿單 #### 函式練習 ```python a = 5 b = 10 def add_sum(a, b): return a+b def sub_sum(a, b): return a-b def mult_sum(a, b): return a*b def div_sum(a, b): return a/b print(add_sum(a, b)) print(sub_sum(a, b)) print(mult_sum(a, b)) print(div_sum(a, b)) ``` #### 讓照片轉起來 ```python # 想一下怎麼讓照片轉起來 ``` #### 跑馬燈 ```python # 剛剛教你顯示文字了,試著結合之前的迴圈,做出跑馬燈 ``` #### 讓眼睛動起來 ```python # 試試看吧 ``` #### 讓紅綠燈動起來 ```python # 讓紅綠燈動起來 # 加入秒數 # 讓他看起來像路上的紅綠燈 ``` #### 測試按鈕 ```python while True: L = webai.btnL.btn.value() R = webai.btnR.btn.value() print(L, R) time.sleep(0.2) Google雲端硬碟可以存放圖片也可以分享, 但分享出來的網址並非圖片的連結,而是服務程式。 將分享的網址轉換如下即可取得圖片連結 原網址:https://drive.google.com/file/d/字串/view 轉換網址:https://drive.google.com/uc?id=字串 --- ``` buber 函式練習 ```python a = 5 b = 10 def add_sum(a, b): return a+b def sub_sum(a, b): return a-b def mult_sum(a, b): return a*b def div_sum(a, b): return a/b print(add_sum(a, b)) print(sub_sum(a, b)) print(mult_sum(a, b)) print(div_sum(a, b)) ``` 讓照片轉起來 ```python for i in range(0, 361, 2): webai.img = webai.res.loadImg('photo.jpg') webai.img.rotation_corr(y_rotation=i, x_translation=0, zoom=1) webai.show(img=webai.img) ``` 跑馬燈 ```python webai.img = None while True: for i in range(320,-400,-5): webai.draw_string(i, 100, 'WEBDUINO認證中心', scale=2) ``` 讓眼睛動起來 ```python # 試試看吧 ``` 讓紅綠燈動起來 ```python # 讓紅綠燈動起來 # 加入秒數 # 讓他看起來像路上的紅綠燈 ```