---
# System prepended metadata

title: 任務挑戰三：ChatGPT AI 程式題詠唱訓練 (Sam)

---

# 任務挑戰三：ChatGPT AI 程式題詠唱訓練 (Sam)

## 1. 請用 chatGPT 解答10 道 if+function 題目 (2,4,6,8,10)

### 題目二：飲酒測試
最低法定飲酒年齡為 18 歲，請撰寫一個函式來測驗輸入的年齡是否能飲酒。

Input:
```
Write a function to check if the input age is above the minimum legal drinking age in Taiwan, which is 18. If the input is larger than the legal age, return true, else return false.
```

結果：

![](https://i.imgur.com/WIdKBzX.png)

### 題目四：溫標轉換
目前常見的溫度標示有攝氏(°C)與華氏(°F)，請撰寫兩個函式可以轉換彼此四捨五入至小數第一位。

Input:
```
Write two functions to convert the input temperature from Celsius to Fahrenheit, and from the opposite unit. The return value should be rounded to the first decimal place.
```

結果：

![](https://i.imgur.com/hcbslOs.png)


### 題目六：計算球體體積
請製作一個球體積計算函式，參數為半徑，回傳計算後四捨五入取至第一位小數的結果。

Input:
```
Write a function to calculate the volume of a sphere with the input radius. The return value should be rounded to the nearest tenth.
```

結果：

![](https://i.imgur.com/zI26NKd.png)

### 題目八：斜邊計算
直角三角形的斜邊長度公式為：x² + y² = z²，請製作一個輸入兩邊邊長並回傳四捨五入取至小數第一位斜邊的函式。

Input:

```
Write a function to calculate the hypotenuse with two inputs, leg a and leg b. The return value should be rounded to the first decimal place.
```

結果：

![](https://i.imgur.com/QMCPABM.png)


### 題目十：蜘蛛下網

Input:
```
Write a function to tell if the given x and y axis are within the given board length and width.
The return value should be a message telling how far is between the given dot (x and y axis) and the nearest corner (top-left, top-right, bottom-left and bottom-rigth). The message should be returned in Chinese like: "右上角為最近的支撐點，距離 4.2 單位".
If the given x and y axis exceed the given board length and width, it should return "蜘蛛不在網上了".
```

結果：

![](https://i.imgur.com/aO1VkX8.png)

## 2. 請用 chatGPT 詠唱以下 Bootstrap 5 文件的募資網站中，詠唱下圖範圍版型，並分享自己的詠唱語法與 Codepen，來看哪組的小組詠唱能力最接近。

[Codepen](https://codepen.io/samchiu064/pen/BaORgmm)

Input:
```
Create a webpage in 2 column layout using Bootstrap 5 following below guidelines. 

1. Write a container contains two rows and is filled with background color #F8F9FA.
2. The first row contains a badge with backround secondary and text "魔法科技", and a level-4 heading with text content "拍出會動的照片｜LivePhotos 魔法拍立得".
3. The second row contains two columns. The first column spans 7 of the row and the second column span 5 of the row, following the grid system of Bootstrap 5.
4. The first column of the second row has an image with url: https://hexschool.github.io/boootstrap5WebLayout/assets/produt_image.jpg.
5. On top of the second column of the second row is a paragraph: "目標 $600,000", below that is a paragraph: "$280,047" with level-4 font-size using the utility of Bootstrap 5.
6. Coming after that is a progress bar with 41% width. Below that has two divs, the left one has a paragraph: "贊助人數" and a paragraph: '1374 人'. The right one has a parahraph: "募資倒數" and a parahraph: "27 天".
7. Coming after that has a div with 4 icons in a row, the url image from left to right are: https://hexschool.github.io/boootstrap5WebLayout/assets/icon_good01.svg, https://hexschool.github.io/boootstrap5WebLayout/assets/icon_good02.svg, https://hexschool.github.io/boootstrap5WebLayout/assets/icon_good03.svg and https://hexschool.github.io/boootstrap5WebLayout/assets/icon_good04.svg.
8. Below those icons is a content block with a paragraph "專案募資中！</br> 在 2021/06/14 23:59 募資結束前，您都可以贊助我們！"
9. Below the content block menetioned in point 8 is a full-width block button with 26px border radius and background color #FFDF65. There's a text message "贊助專案" in the middle of the button.
10. Belown the button are two buttons, both of them are with 26px border radius, 2 px solid #858377 border, font-color #858377 and font-size 20px. The left one spans 6 of the row, in the middie of the button has a heart icon (name: heart) from Font Awesome and text "追蹤專案", while the right one has a icon (name: shaer-alt) from Font Awesome and text: "分享".

Can you provide the code in 6 separate responses?
```

![](https://i.imgur.com/Cle3ueW.png)
