程式設計第六組
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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 New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 第十五週 ## 上課內容 ### 課堂小考 * [題目](https://hackmd.io/efgEA1MTSmm1e2rvx1LhXg) #### 第一題 > 請定義一個函數myFunction,傳入一個參數n。 > 此函數可以計算出1╳2╳3╳…╳n的總和。函數能傳回後的總和。(必須用for迴圈完成) * 禮仁助教解題+說明 ``` def myFunction(n): total = 1 for i in range(1, n+1): total *= i return total print(myFunction(10)) ``` ![](https://i.imgur.com/SumL6Vi.png) #### 第二題 > 請定義一個函數myFunction。 > 此函數可以列出1到9的乘法表,列出的方式如下所示:(必須用for迴圈完成) > 乘法1 1╳1=1 1╳2=3 . . . 9╳9=81 * 奕良助教題解+說明 ``` def myFunction(n): for i in range(n): for j in range(n): print(i+1,"x",j+1,"=",(i+1)*(j+1)) myFunction(9) ``` ![](https://i.imgur.com/whH76uL.png) ![](https://i.imgur.com/0OL6w0h.png) 、 、 、 ![](https://i.imgur.com/ROLIMHJ.png) #### 第三題 > 在老師上課分享的資料匣中,有一個全國路名的檔案「opendata110road.csv」 > 1.用迴圈找出全國的「中山路」 > 2.用迴圈算出全國的「中山路」的數目 > 3.用迴圈與判斷式找出高雄市有幾個區,並將每個區只能印出來一次,區不可重複 * 煜鈞助教解題+說明 ``` import pandas as pd data = pd.read_csv('/content/drive/MyDrive/data/opendata110road.csv') #第一小題 road = data[data['road'].str.startswith('中山路')] print(road) print(type(road)) #第二小題 print(f"全國共有 {road['road'].count()} 條中山路") #第三小題 khh = data[data['city'] == '高雄市'] khh_site_id = khh['site_id'].unique() print(khh_site_id) print(f"共有 {len(khh_site_id)} 個區") ``` ![](https://i.imgur.com/QS5XgT5.png) ![](https://i.imgur.com/pmqC2HC.png) #### 第四題 > 請定義一個函數myFunction,傳入一個參數n。此函數可以找出所有除數,這些除數除以n能夠整除,並將這些因數印出到螢幕上。 > 例如:假設你傳入參數10,函數印出 1,2,5,10。列印時從1印出。(必須用for迴圈與判斷式完成) * 珮瑜助教解題+說明 ``` def myFunction(n) : for i in range(1,n+1) : if(n % i == 0) : print(i, end=' ') myFunction(int(input())) ``` ![](https://i.imgur.com/RRNvHYf.png) #### 第五題 > 請定義一個函數myFunction,傳入一個參數n。此函數可以找出所有除數,這些除數除以n不能夠整除,並將這些因數印出到螢幕上。 > 例如:假設你傳入參數10,函數印出 3,4,6,7,8,9。除數要小於n(必須用for迴圈與判斷式完成) * 仲廷助教解題 珮瑜助教說明 ``` def myfunction(n): for i in range(1,n): if(n%i!=0): print(i) myfunction(100) ``` ![](https://i.imgur.com/Rn35jV4.png) ![](https://i.imgur.com/D8FpOPw.png) 、 、 、 ![](https://i.imgur.com/P5xDRoK.png) #### 第六題 > 在老師上課分享的資料匣中,有一個「身高體重.xlsx」 請用散佈圖畫出5個人的資料。x軸為身高,y軸為體重。 * 仲廷助教解題 珮瑜助教說明 ``` import pandas as pd import matplotlib.pyplot as plt df = pd.read_excel('/content/drive/MyDrive/EXAM/身高體重.xlsx') x=[] y=[] for i in range(0,df["身高"].count()): x.append(df.at[i,"身高"]) y.append(df.at[i,"體重"]) plt.scatter(x,y,s=5) plt.axis('square') plt.xlim(150,200) plt.ylim(40,100) plt.show() import pandas as pd import matplotlib.pyplot as plt df = pd.read_excel('/content/drive/MyDrive/EXAM/身高體重.xlsx') plt.scatter(df["身高"],df["體重"]) plt.show() ``` ![](https://i.imgur.com/qmyYF39.png) ![](https://i.imgur.com/FlQgk1S.png) ## 開會紀錄 * 開會時間:5/28(六) 16:00~17:00 * 討論內容: * 1. 小考檢討 2. 討論下次開會時間 * 開會截圖: ![](https://i.imgur.com/PNeNJXA.jpg)

    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