看板 [ Python ]
討論串[問題] 簡單的迴圈問題
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓4(4推 0噓 4→)留言8則,0人參與, 5年前最新作者AmigoSafin時間5年前 (2019/06/23 22:35), 編輯資訊
1
0
0
內容預覽:
大家好. 題目是假設給一個n. 要print出小於n的square number. 例如 n給25. 則print出 1 4 9 16. 我的code會把0也print. 提示說就是寫一個while loop. 所以我也就是照提示寫 如下:. 還請各位高手幫忙 謝謝!. import math. n
(還有141個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者WayneHong (韋恩)時間5年前 (2019/06/24 08:31), 編輯資訊
0
0
0
內容預覽:
5行就可以了. 不知道有沒有更好的解法. number = int(input()). ans = []. for i in range(1,number):. if len(str(pow(i,0.5)))<4:. ans.append(i). print(ans). pow():找出引數1的引數
(還有8個字)

推噓2(2推 0噓 7→)留言9則,0人參與, 5年前最新作者AmigoSafin時間5年前 (2019/07/08 01:39), 編輯資訊
0
0
0
內容預覽:
大家好~. 不好意思又來打擾. 我今天忙完其他作業. 又打開練習 重新寫一次. 如下:. n=int(input()). counter=0. while counter*counter<n:. counter=counter+1. print(counter*counter). 但我的答案都會包含
(還有188個字)
首頁
上一頁
1
下一頁
尾頁