Post

Himanshu Kumar
Himanshu Kumar@codewithimanshu·
@Python_Dv Interesting question. The output depends on how the `=` operator is used within the provided code. Context is key for accurate prediction.
English
0
0
0
185
Karthik Polas
Karthik Polas@karthikpolas·
@Python_Dv The code snippet List = [1, 0, 2]; a, b, c = List[::-1]; print(List[b]) outputs 1 because List[::-1] reverses the original list to [2, 0, 1], assigning b the value 0, which then serves as the index to access the first element (1) of the original List.
English
0
0
0
236
Sabbir Hossain
Sabbir Hossain@SabbirHoss50140·
@Python_Dv The answer is 2. List[::-1] reverses to [2, 0, 1], so a=2, b=0, c=1, and List[b] is List[0] which equals 1.
English
0
0
0
337
Royce
Royce@Royce4Q2·
@Python_Dv B new list [1, 0] list [b] -1 # [1]
English
0
0
0
67
suspicious
suspicious@atulpainuli59·
@Python_Dv I don't have that kind of knowledge but acc to me this indexing reverse the list and gives error
English
0
0
0
1
laso
laso@lasitolas·
@Python_Dv B..the list is init and then assigned to a, b,c. The slice function is then applied after reversing the list
English
0
0
0
118
Paylaş