---
# System prepended metadata

title: 4-4：整數與浮點數
tags: [DICE Python]

---

---
title: 4-4：整數與浮點數
lang: zh-tw
tags: DICE Python
---


4-4：整數與浮點數
===

> [name=Chinglin-K]

---

目錄：[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu)
上一篇：[4-3：指定浮點數](https://hackmd.io/@Chinglin-K/Dice-4-3)
下一篇：[4-5：=不是等號](https://hackmd.io/@Chinglin-K/Dice-4-5)

---
## 題目
寫一個程式，輸入一個整數為160，一個浮點數為55.22，分別代表身高與體重，並印出其值，格式如輸出範例所示，呈現小數點後2位。

輸入範例:

輸出範例:
My height is 160 CM.
My weight is 55.22 KG.

    
---

## 程式碼
    
```Python=
i=160
j=55.22
print(f"My height is {i} CM.")
print(f"My weight is {j} KG.")
```
    
---

## 輸出
    
```Python=
My height is 160 CM.
My weight is 55.22 KG.
```
    
---

目錄：[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu)
上一篇：[4-3：指定浮點數](https://hackmd.io/@Chinglin-K/Dice-4-3)
下一篇：[4-5：=不是等號](https://hackmd.io/@Chinglin-K/Dice-4-5)
    
---

:::info

「盡多少本分，得多少本事」😊
:::

---
    
{%hackmd i1nMRrZcTFmTvoF897K9zg %}