※ 本文轉寄自 ptt.cc, 文章原始頁面
Re: [閒聊] 做程式的請進
※ 引述《Wardyal (我獨自升級 超級好看!)》之銘言:
: 我今天在用寫一個測試的軟體 到時候會包成exe
: 寫法就
: global_var1
: global_vaw2...
: def test_fun1():
: ...
: def test_fun2():
: ...
: if __name__ == "__main__":
: ret = []
: test_funs = [test_fun1, test_fun2...]
: for i in range(CASE_AMOUNT):
: ret.append(test_funs[i](...))
: ...
: # 印出結果
: 寫是差不多寫完了 但是總感覺哪裡怪怪的 好像沒有到很美觀
: 其他像是一些要判斷很多的 寫到後面變成
: if A:
: if B:
: if C:
: return 1
: else:
: return -3
: else:
: return -2
: else:
: return -1
: 這種感覺
: 這個的話有啥比較好的寫法嗎
把程式碼改成
if !A:
return -1;
if !B
return -2;
if !C
return -3;
return 1;
好像叫flatten還甚麼的吧 忘了
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.115.131.159 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1707137212.A.401.html
Re: 回文串
1128
[閒聊] 做程式的請進
Marginalman02/05 17:59
22
Re: [閒聊] 做程式的請進
Marginalman02/05 18:22
414
Re: [閒聊] 做程式的請進
Marginalman02/05 18:34
00
Re: [閒聊] 做程式的請進
Marginalman02/05 18:48
22
Re: [閒聊] 做程式的請進
Marginalman02/05 18:59
00
Re: [閒聊] 做程式的請進
Marginalman02/05 19:02
314
Re: [閒聊] 做程式的請進
Marginalman02/05 19:31
34
Re: [閒聊] 做程式的請進
Marginalman02/05 20:14
11
Re: [閒聊] 做程式的請進
Marginalman02/05 20:18
22
Re: [閒聊] 做程式的請進
Marginalman02/05 20:19
214
Re: [閒聊] 做程式的請進
Marginalman02/05 20:37
312
Re: [閒聊] 做程式的請進
Marginalman02/05 20:38
16
> Re: [閒聊] 做程式的請進
Marginalman02/05 20:46
34
Re: [閒聊] 做程式的請進
Marginalman02/05 20:53
00
Re: [閒聊] 做程式的請進
Marginalman02/05 21:02
11
Re: [閒聊] 做程式的請進
Marginalman02/05 21:11
3347
Re: [閒聊] 做程式的請進
Marginalman02/05 23:28
58
Re: [閒聊] 做程式的請進
Marginalman02/05 23:35
413
Re: [閒聊] 做程式的請進
Marginalman02/05 23:44
06
Re: [閒聊] 做程式的請進
Marginalman02/06 01:06
6 則留言
ILoveErr 作者的近期文章
Re: 所以台麥是不是沒救了
※ 引述《medama ( )》之銘言: : 標題: Re: 所以台麥是不是沒救了 : 時間: Mon Mar 11 13:26:01 2024 : : 最近雞塊特價 : 67元12個 : 還不錯 : : 特價雙人早餐也比早餐店還便宜 :
Re: 笑死 那if超好笑
簡單翻譯一下 可能不是很精準 ※ 引述《mayolane (沒有人啦)》之銘言 : ※ 引述 《oz5566》 之銘言: : : 探子說 : : 日本觀眾很了解 我不會私約 ptt的是我不知道 : : if說 : : 会いうのことは常識やw
Re: [閒聊] 探子的龍寶寶還來得及
※ 引述《weitea554 (wei)》之銘言 : 哲瑋的孩子 : 會是射手座 屬龍 2043年學測 : 龍寶寶也是很競爭的 :-- : Sent from BePTT on my iPhone16,1 有一天,我的女兒問我: 「爸爸,你
Re: 民眾黨太囂張小心被架空
※ 引述《walter741225 (瓦特 \\|/)》之銘言: : 標題: Re: 民眾黨太囂張小心被架空 : 時間: Tue Jan 16 11:41:23 2024 : : : 這幾天這樣看下來 : : 我又聞到受虐兒的味道了 : :
Re: [閒聊] 新輔助裝
※ 引述《NPttnoob (難道阿扁臭了嗎)》之銘言 : https://youtu.be/DnFUVpbyi2Y?si=INHhi5ezVUzLaYbz : 應該會修吧 : 不然像這樣一路買兩件 : 很恐怖誒 賽劍我已經研究好了 一等蹲
→
→
→
→
推
→