--- title: 21-6:統計資料 lang: zh-tw tags: DICE Python --- 21-6:統計資料 === > [name=Chinglin-K] --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[21-5:交換資料](https://hackmd.io/@Chinglin-K/Dice-21-5) 下一篇:[21-7:人數判斷](https://hackmd.io/@Chinglin-K/Dice-21-7) --- ## 題目 寫一個程式,紀錄一周的動物園遊園人數,如下表,後來發現星期六與星期日的統計結果相反了,請用交換的功能來修正統計的結果。 印出原來的清單,再印出交換後的清單 星期日 70人 星期一 10人 星期二 14人 星期三 7人 星期四 25人 星期五 30人 星期六 50人 輸入範例: 輸出範例: 星期日: 50人 星期一: 10人 星期二: 14人 星期三: 7人 星期四: 25人 星期五: 30人 星期六: 70人 --- ## 程式碼 ```Python= num=[50, 10, 14, 7, 25, 30, 70] print(f"星期日: {num[0]}人") print(f"星期一: {num[1]}人") print(f"星期二: {num[2]}人") print(f"星期三: {num[3]}人") print(f"星期四: {num[4]}人") print(f"星期五: {num[5]}人") print(f"星期六: {num[6]}人") ``` --- ## 輸出 ```Python= 星期日: 50人 星期一: 10人 星期二: 14人 星期三: 7人 星期四: 25人 星期五: 30人 星期六: 70人 ``` --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[21-5:交換資料](https://hackmd.io/@Chinglin-K/Dice-21-5) 下一篇:[21-7:人數判斷](https://hackmd.io/@Chinglin-K/Dice-21-7) --- :::info 「盡多少本分,得多少本事」😊 ::: --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}
×
Sign in
Email
Password
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