0

Why design like this?

Most of the time, a comma won't follow the last item in a list. However, it is perfectly valid to place one there, and it is encouraged in some cases.

24th Jul 2020, 5:23 AM
吳宗原
吳宗原 - avatar
6 Respuestas
+ 4
so when adding item at the end, there will not be error because of missing comma 設計上,這樣可以避免error
24th Jul 2020, 5:36 AM
Gordon
Gordon - avatar
0
Sir , How to change A as [3,2,4] in one line ? A=[1,2,] print (type(A)) print (A) A[???]=(3,4) print (type(A)) print (A)
24th Jul 2020, 3:59 PM
吳宗原
吳宗原 - avatar
0
唔唔明你想達到甚麼 A[???] = (3,4) 這句 是想最後print出甚麼結果?
24th Jul 2020, 10:22 PM
Gordon
Gordon - avatar
0
怎麽用一條編碼將 A=[1,2,]改成 A=[3,2,4]
25th Jul 2020, 4:30 AM
吳宗原
吳宗原 - avatar
0
A[0] = 3 A.append(4)
25th Jul 2020, 5:06 AM
Gordon
Gordon - avatar
0
有辦法用一行解決嗎
25th Jul 2020, 12:41 PM
吳宗原
吳宗原 - avatar