#28721: Python 解答


oxxostudio (oxxo.studio)

學校 : 不指定學校
編號 : 173961
來源 : [220.133.228.250]
最後登入時間 :
2022-07-21 09:26:00
a038. 數字翻轉 | From: [122.117.124.140] | 發表日期 : 2021-12-29 13:25

這個題目會運用「串列的反轉」,先將輸入的文字轉換成串列 ( 使用 input 就算輸入的是數字,類型仍然是文字 ),
接著使用 [::-1] 反轉陣列,再將反轉後的陣列組合成字串,
最後使用 int 將字串轉換成數字,就會自動消除開頭的 0。

解答:https://steam.oxxostudio.tw/category/python/zerojudge/a038.html

 
ZeroJudge Forum