--- title: 19-4:x的y次方 lang: zh-tw tags: DICE Python --- 19-4:x的y次方 === > [name=Chinglin-K] --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[19-3:圓面積與體積](https://hackmd.io/@Chinglin-K/Dice-19-3) 下一篇:[19-5:質數判斷](https://hackmd.io/@Chinglin-K/Dice-19-5) --- ## 題目 請自訂 madepow(x,y) 函式練習。 設計一個 madepow(x,y) 函式,計算 x 的 y 次方,直到 x=0 為止。 輸入範例: 3 2 4 3 10 2 5 4 6 3 0 輸出範例: 9 64 100 625 216 --- ## 程式碼 ```Python= import math def madepow(x,y): return pow(x,y) while True: x=int(input()) if(x==0): break y=int(input()) print(madepow(x,y)) ``` --- ## 輸出 ```Python= ``` --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[19-3:圓面積與體積](https://hackmd.io/@Chinglin-K/Dice-19-3) 下一篇:[19-5:質數判斷](https://hackmd.io/@Chinglin-K/Dice-19-5) --- :::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