# Python Ch4-2 ###### tags: `python2021` * 要求 (request): * 格式請依照ex1的標準 (檔名:ex4-1.py, ex4-2.py...,最後將所有檔案壓縮至學號.zip or 學號.7z上傳e3) * 輸出檔案內容以TA截圖為標準 --- # Question 1 The two list store the info of exon position, print the three exon by **using for loop**. ```python # set the values of all the sequence variables exon_start_list = [12, 30, 52] exon_end_list = [21, 41, 62] #12~21 include 12, exclude 21, total 9 base seq_3 = "ATTATATATAGAGAGAGAGAGAGAGATGTGTGTGTTGCACACACAAACACACAAAAAAGCGGGCCCGCGCGCGGGTATAGAGACACAGTATTGGAGATTTGGACACACATG" #you can not modify the code that TA given #just copy and keep writing your own code. ``` Output: ![](https://i.imgur.com/lUtbLZ4.jpg) --- # Question 2 First, copy the following string into your program. ```python team="PG: Stephen Curry;SG: Kobe Bryant;SF: Lebron James;PF: Giannis Antetokounmpo;C: Yao Ming" ``` (1) Add "is the best player." behind each player of team list. (2) Calculate the length of each sentence. (3) You must use for loop. :::info Hint: Use .split() ::: Output: ![](https://i.imgur.com/jSKsrUL.jpg) --- # Question 3 Write a program about the multiplication table (九九乘法表). :::info Note: 1. Please make the same layout as the following picture. 2. To avoid automatic line feed, use: ```python print(string,end="") or print(string,end="\t") ``` ::: Output: ![](https://i.imgur.com/Rq1ZGps.jpg) --- # Question 4 This is a interesting, but also a difficult one. First, to input something into your program as a variable, we can use: ```python a = input("input:") ``` Then we can manipulate the variable a. Now, try to write a program; when we input "3", the output would be like: ![](https://i.imgur.com/3KnQOoC.jpg) When we input "5", the output would be like: ![](https://i.imgur.com/YS6eBej.jpg) and so on.