Skip to content
Related Articles

Related Articles

Improve Article
Python-Quizzes | Python List Quiz | Question 25
  • Last Updated : 17 Sep, 2020

Question 25: Find the output of the following program:




def REVERSE(L): 
    L.reverse() 
    return(L) 
def YKNJS(L): 
    List = [] 
    List.extend(REVERSE(L)) 
    print(List
  
L = [1, 3.1, 5.31, 7.531
YKNJS(L) 

(A) [1, 3.1, 5.31, 7.531]
(B) [7.531, 5.31, 3.1, 1]
(C) IndexError
(D) AttributeError: ‘NoneType’ object has no attribute ‘REVERSE’


Answer: (B)

Explanation: REVERSE() reverses the list and returns it. YKNJS() adds reverse of a list L to the empty list List. L = [1, 3.1, 5.31, 7.531], gets reversed and becomes [7.531, 5.31, 3.1, 1].

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :