--- title: 18-2:x的y次方 lang: zh-tw tags: DICE Python --- 18-2:x的y次方 === > [name=Chinglin-K] --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[18-1:找絕對值](https://hackmd.io/@Chinglin-K/Dice-18-1) 下一篇:[18-3:算平方根](https://hackmd.io/@Chinglin-K/Dice-18-3) --- ## 題目 使用 math 模組的 pow(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 #->題目要求使用pow(x,y) while True: x=int(input()) if(x==0): break y=int(input()) print(pow(x,y)) ``` --- ## 輸出 ```Python= ``` --- 目錄:[Dice 程式教學-Python完整版](https://hackmd.io/@Chinglin-K/Dice-menu) 上一篇:[18-1:找絕對值](https://hackmd.io/@Chinglin-K/Dice-18-1) 下一篇:[18-3:算平方根](https://hackmd.io/@Chinglin-K/Dice-18-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