ts-boring
    • 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    <!--introduction--> # 10/25 第七堂社課 ## 今日講師:R緯 #### (Python班) --- # 今日課程主題: ---- # 複習-多變數的輸入 (map) ---- # 簡介陣列 (array) ---- # 列表 ∨ 串列 (list) ---- # 遍歷陣列 (array traversal) ---- # 歡樂題目time ```python if 還有時間: 補充「重複」的4大類型 深入解釋map() ``` --- # 多變數的輸入 (map) ---- ## map() 函式語法&參數: ```python map(函式, 可迭代值, ...) map(function, iterable, ...) ``` ---- ```python a, b, c... = map(int, input().split()) ``` input().split() 將輸入的內容 以split的括號內的內容做為sep 進行切割 split的括號內預設為" " (空格) ---- 舉例#1 ```python= a, b, c = map(int, input().split()) print(a, b, c, sep=" ") a, b, c = map(int, input().split(" ")) print(a, b, c, sep=" ") a, b, c = map(int, input().split("hsnu")) print(a, b, c, sep=" ") m = "hello" a, b, c = map(int, input().split(m)) print(a, b, c, sep=" ") ``` ---- 舉例#1 output ![image](https://hackmd.io/_uploads/HkbWwMdg1x.png) --- # 簡介陣列 (array) ---- ## 一個陣列可以儲存很多資料 ## 陣列最基本的目的:減少變數 ---- ## 陣列的種類:4種 * 列表 ∨ 串列(List) * 元組(Tuple) * 字典(Dictionary) * 集合(Set) [陣列類型簡介](https://www.pcschool.com.tw/blog/it/python-data-structures) ---- ## 與上一屆相同,本課程著重在自由度最高的list --- # 列表 ∨ 串列 (list) ---- * 同一個list裡面可以有不同型別 * list[位置] 位置由0開始 * len()可以得出該list的長度 ---- 最簡單的建立一個list,就是直接打出來 舉例#2 ```python= list1 = [1, 2, 3, "hello", 9.9] print(list1) for i in range(5): print(list1[i]) print("len = ", len(list1)) ``` ---- 舉例#2 output ![image](https://hackmd.io/_uploads/r1UsRGdlJg.png) ---- ## list好眼熟? [9/13 第一堂社課 #3-10頁](https://hackmd.io/oN27EFsxRfeoNwYDfY1pTQ#/3/10) ---- ## 字串是一種list ## 字串就是「字元的串列」 ---- ## append & pop 在一個list中增加、減少資料 * 增加 list.append(想增加的資料) 會增加在list最右邊 * 刪減 list.pop(**位置**) 會刪除該位置的資料 ---- 舉例#3 ```python= list1 = [1, 2, 3, "hello", 9.9] print(list1) list1.append("wow") print(list1) list1.pop(3) print(list1) ``` ---- 舉例#3 output ![image](https://hackmd.io/_uploads/Sk8KzmOgke.png) ---- ## 一次性將多個資料做成list ## ,會用到list()函式 ---- 最常遇到range()、多變數輸入 做成list 舉例#4 ```python= list1 = list(map(int, input().split())) print(list1) list2 = list(range(2, 26, 2)) print(list2) ``` ---- 舉例#4 output ![image](https://hackmd.io/_uploads/rkaLE7dxJl.png) ---- 練習#1 已知國立臺灣師範大學附屬高級中學目前共有3個年級,假設高二高三皆有30班,高一有25班,請創造一個串列,使得裡面有從高三第一個班一直到高一最後一個班。 (假設高二的第一個班叫做1626) --- # 遍歷陣列 (array traversal) ---- 遍歷陣列是指訪問陣列所有元素的過程。 遍歷通常的目的是對集合中每個元素進行操作。 [10/4 第四堂社課 #2-1頁](https://hackmd.io/NMX-HZVuTdexQHN33WX3YQ#/2/1) ---- 舉例#5 ```python= list1 = [152, 183, 84, "hello", 1.39] for i in list1: print(i) ``` ```python= list1 = [152, 183, 84, "hello", 1.39] for i in range(len(list1)): print(list1[i]) ``` 舉例#5 output ![image](https://hackmd.io/_uploads/BJ2-qQdgkl.png) ---- 練習2 承練習1,運用遍歷陣列的方式,找出你的班級,並將該位置的值訂為字串My Class --- # 歡樂題目time ---- ## 練習3 ## 矩陣的翻轉 ---- ```python= row, column = map(int, input().split()) list1=[] for i in range(row): list2=list(map(int,input().split())) list1.append(list2) for i in range(column): for j in range(row): print(list1[j][i],end=" ") print() ``` --- # END [有興趣來看「重複結構」](https://hackmd.io/@ts-boring/BJF9VN_lkl)

    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