2015FALL 40123210 CPB 作業

2015 計算機程式 作業13

以下為作業13內容

利用 iframe 嵌入投影片:

作業13投影片

Jupyter notebook 檔案內容:

學號-姓名

In [1]:
g10_number = ["40123210","40123157","40123254"]
g10_name = ["蔡依靜","盧毅民","鍾文榮"]

for i in range (len(g10_number)):
    print(g10_number[i],g10_name[i],sep = "-")
40123210-蔡依靜
40123157-盧毅民
40123254-鍾文榮
In [ ]:
 
學號-姓名 空一行
In [1]:
g10_number = ["40123210","40123157","40123254"]
g10_name = ["蔡依靜","盧毅民","鍾文榮"]

for i in range (len(g10_number)):
    print(g10_number[i],g10_name[i],sep = "-",end = "\n\n")
40123210-蔡依靜

40123157-盧毅民

40123254-鍾文榮

In [ ]:
 
第幾個字為蔡
In [1]:
name = '蔡依靜'
for i in range (len(name)):
    if name[i] == "蔡":
        print("第",i+1,"個字元為蔡")
第 1 個字元為蔡
In [ ]:
 
有幾個姓蔡
In [1]:
cpb_number = ['40023215', '40123157', '40123210', '40123254', '40223252', '40423201', '40423202',
              '40423203', '40423204', '40423205', '40423206', '40423207', '40423208', '40423209',
              '40423210', '40423211', '40423212', '40423213', '40423214', '40423215', '40423216',
              '40423217', '40423218', '40423219', '40423220', '40423221', '40423222', '40423223',
              '40423224', '40423225', '40423226', '40423227', '40423228', '40423229', '40423230',
              '40423231', '40423232', '40423233', '40423234', '40423235', '40423236', '40423237',
              '40423238', '40423239', '40423240', '40423241', '40423242', '40423243', '40423244',
              '40423245', '40423246', '40423247', '40423248', '40423249', '40423250', '40423251',
              '40423252', '40423253', '40423254']

cpb_name = ['吳承融', '盧毅民', '蔡依靜', '鍾文榮', '羅竟豪', '黃上芸', '楊俐瑾', '鄭惟芯', '王子陽',
            '王彥斌', '王驍捷', '朱修林', '江碩宸', '余柏諺', '吳丹邁', '吳東霖', '吳秉駿', '李世欽',
            '李奇軒', '李泓毅', '李彥錞', '阮奕誠', '周政叡', '林宏一', '林易寬', '林建辰', '林稟儀',
            '林德威', '林瀟俊', '洪嘉緯', '胡原愷', '徐英軒', '張育誠', '張祐瑜', '張竣皓', '連緒',
            '郭金豪', '郭雲軒', '陳俊瑋', '陳威憲', '陳韋凡', '陳憲棠', '彭子旻', '游智文', '黃柏杰',
            '黃鈺灃', '楊哲維', '楊錦鑫', '詹晏傑', '廖洪欽', '劉永駿', '劉俊成', '蔡昆傑', '蔡憲佳',
            '鄭裕倫', '賴信穎', '謝孟哲', '簡嘉宏', '蘇柏丞']

# 碼表歸零
count = 0
# 設法逐一列出成員姓名
for i in range (len(cpb_name)):
    # 已經取得各成員姓名為 cpb_name
    # 因為只對姓進行檢查, 而姓為 cpb_name[i][0]
    # 利用 if 判斷姓是否為 "蔡"
    if cpb_name[i][0] == "蔡":
        count += 1
print(count)
3
In [ ]:
 
點名
In [1]:
cpb_number = ['40023215', '40123157', '40123210', '40123254', '40223252', '40423201',
              '40423202', '40423203', '40423204', '40423205', '40423206', '40423207',
              '40423208', '40423209', '40423210', '40423211', '40423212', '40423213',
              '40423214', '40423215', '40423216', '40423217', '40423218', '40423219',
              '40423220', '40423221', '40423222', '40423223', '40423224', '40423225',
              '40423226', '40423227', '40423228', '40423229', '40423230', '40423231',
              '40423232', '40423233', '40423234', '40423235', '40423236', '40423237',
              '40423238', '40423239', '40423240', '40423241', '40423242', '40423243',
              '40423244', '40423245', '40423246', '40423247', '40423248', '40423249',
              '40423250', '40423251', '40423252', '40423253', '40423254']

cpb_name = ['吳承融', '盧毅民', '蔡依靜', '鍾文榮', '羅竟豪', '黃上芸', '楊俐瑾', '鄭惟芯',
            '王子陽', '王彥斌', '王驍捷', '朱修林', '江碩宸', '余柏諺', '吳丹邁', '吳東霖',
            '吳秉駿', '李世欽', '李奇軒', '李泓毅', '李彥錞', '阮奕誠', '周政叡', '林宏一',
            '林易寬', '林建辰', '林稟儀', '林德威', '林瀟俊', '洪嘉緯', '胡原愷', '徐英軒',
            '張育誠', '張祐瑜', '張竣皓', '連緒', '郭金豪', '郭雲軒', '陳俊瑋', '陳威憲',
            '陳韋凡', '陳憲棠', '彭子旻', '游智文', '黃柏杰', '黃鈺灃', '楊哲維', '楊錦鑫',
            '詹晏傑', '廖洪欽', '劉永駿', '劉俊成', '蔡昆傑', '蔡憲佳', '鄭裕倫', '賴信穎',
            '謝孟哲', '簡嘉宏', '蘇柏丞']

import random
roll_call_num = int(input("how many roll calls?"))
for i in range(roll_call_num):
    roll = random.randint(0, len(cpb_number)-1)
    print(cpb_number[roll],cpb_name[roll])
how many roll calls?2
40423247 劉俊成
40423224 林瀟俊
In [ ]:
 

w13-1_2015_12_11 from 40123210 on Vimeo.

w13-2_2015_12_11 from 40123210 on Vimeo.

Comments