``python= def input_equation(): valid = False while not valid: equation = input("請輸入方程式:") equation = equation.replace(" ", "") # 移除空白 # 檢查方程式是否合法 match = re.match(r"\((\d*)x([\+\-]\d*)y\)\^(\d*)", equation) if match: valid = True else: print("") return match.groups() # 回傳使用者輸入的數字 # Problem 1 solution # problem solution write here # you need use input_number funtion in your solution def main(): a, b, c = input_equation() # 構建方程式字串 equation = f"{int(a)**int(c)}*x^{c}+{2*int(a)*int(b)}*x*y+{int(b)**int(c)}*y^{c}" print("展開式:", equation) main() 執行結果:  部分測試成功
×
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