Report Bug
Qus :

What will be the output of the following Python code snippet?

for i in [1, 2, 3, 4][::-1]:
    print (i)

Qus

निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?

for i in [1, 2, 3, 4][::-1]:
    print (i)


A. 1 2 3 4
B. 4 3 2 1
C. error
D. none of the mentioned


Solution
B. 4 3 2 1



Explanation
[::-1] reverses the list.



Report Bug