---
# System prepended metadata

title: Python 2nd review
tags: [python2021]

---

# Python 2nd review
###### tags: `python2021`
* 要求 (request)：
    * 格式請依照ex1的標準 (檔名:ex8-1.py, ex8-2.py...，最後將所有檔案壓縮至學號.zip or 學號.7z上傳e3)
    * 輸出檔案內容以TA截圖為標準

# Question 1: File format transformation and get the gene information.

Now you have a E. coli. (Escherichia coli O157:H7 str. EDL933) gene file in fasta format named "NC_002655.fa".
![](https://i.imgur.com/C6iNqPj.jpg)
Download File: [NC_002655.fa](https://drive.google.com/open?id=14_-8FeG5dAQzaeiBb_cq0bOqDXw3qE7X)


Please create a new file named NC_002655.txt that contains all the gene information and sequence in one line per record (where the spacer is TAB, i.e., \t). Do not forget to remove ">" symbol for the fasta format.
![](https://i.imgur.com/nn2d5ns.png)

By the way, you can see your output results by Excel (open your "NC_002655.txt" file by Excel).

Note:
![](https://i.imgur.com/zguCRRj.jpg)

```python=
First_line_contents = "Gene Symbol\tGene ID\tGene Description\tProtein Accession Number or Non-coding Gene\tGene Sequence\n"
```

# Question 2
There are horses and chickens in a farm. Given that there are 2000 heads and 5972 legs in total, please write a program to compute how many horses and chickens respectively are there in the farm. Note that loop(s) MUST be used in this program.

```python=
for ??? in ???:
    #write something

print("There are " + str(chicken) + " chickens and " + str(horse) + " horses in the farm.")
```

# Question 3:  BMI
Please write a function to input the height (m) and weight (kg) and calculate the BMI (BMI = kg/m2). Finally, print out the BMI value (round to the 2nd place) and classification result (too light, normal weight, too heavy or obese).


The BMI classification:
BMI < 18.5 too light
18.5 ≦ BMI <24 normal weight
24 ≦ BMI <27 too heavy
BMI ≧ 27 obese

For example: 
```python=
def BMI(h,w):
    #write something

print(BMI(1.7,65).....)
```
![](https://i.imgur.com/jCwgWj3.jpg)
