看板 [ Python ]
討論串判斷raw_input輸出資料範圍的問題
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者kanako (我是香民)時間14年前 (2011/02/21 09:44), 編輯資訊
0
0
0
內容預覽:
感謝您. 我後來改成以下的方式:. def get_input():. try:. data = int(raw_input()). except ValueError:. print "Wrong input, input again!!". get_input(). else:. global
(還有365個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者KSJ (阿真)時間14年前 (2011/02/17 16:43), 編輯資訊
0
0
0
內容預覽:
try:. : guessed_num = int(raw_input());. except ValueError:. print "Maybe some error, Please Input a number between 1 and 10.". return. 用例外(exception)
(還有93個字)

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者kanako (我是香民)時間14年前 (2011/02/17 15:44), 編輯資訊
0
0
0
內容預覽:
大家好,我是個python初學者. 想請教各位強者我的練習程式中的問題. 程式碼如下:. import random. def guess_num():. rand_num = int(10*random.random()) + 1. end_flag = False. while end_flag
(還有244個字)
首頁
上一頁
1
下一頁
尾頁