看板 [ Python ]
討論串[問題] list
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓2(2推 0噓 4→)留言6則,0人參與, 最新作者cocokelly (因為失去所以想念)時間15年前 (2009/12/06 19:44), 編輯資訊
0
0
0
內容預覽:
在我看來你是想要達到switch的功能??. 一般Python若要達到switch會用Dict來達到... 好比說.... r_value = {. '1': 'one',. '2': 'two',. '3': 'three'. }[a]. 這樣是你想要的嗎?若回到主題.. 你直接用ListA[a]

推噓3(3推 0噓 3→)留言6則,0人參與, 最新作者ilvicco (家齊說我是螞蟻)時間15年前 (2009/12/06 18:32), 編輯資訊
0
0
0
內容預覽:
def my_problem4_1(a):. if a==1:. return "one". elif a==2:. return "two". elif a==3:. return "three". else:. return "larger than three". Q: 不要用 if-else
(還有94個字)
首頁
上一頁
1
下一頁
尾頁