--- title: 19-2:圓柱體體積 lang: zh-tw tags: DICE Python --- 19-2:圓柱體體積 === > [name=Chinglin-K] --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[19-1:相加](https://hackmd.io/@Chinglin-K/Dice-19-1) 下一篇:[19-3:圓面積與體積](https://hackmd.io/@Chinglin-K/Dice-19-3) --- ## 題目 請用自訂函式解題。 請問高 10,半徑 3 的圓柱體體積(圓周率=3.14)是多少? 以及當半徑多加 2 後,圓柱體體積又會變成是多少? 輸出範例: 半徑3時的圓柱體體積: 282.6 半徑5時的圓柱體體積: 785.0 --- ## 程式碼 ```Python= def area2(r): return r * r * 3.14 def area3(r, h): return area2(r) * h r = 3 print(f'半徑{r}時的圓柱體體積: {area3(r, 10)}') r = 3+2 print(f'半徑{r}時的圓柱體體積: {area3(r, 10)}') ``` --- ## 輸出 ```Python= ``` --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[19-1:相加](https://hackmd.io/@Chinglin-K/Dice-19-1) 下一篇:[19-3:圓面積與體積](https://hackmd.io/@Chinglin-K/Dice-19-3) --- :::info 「盡多少本分,得多少本事」😊 ::: --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up