Four methods of an object in the Python reverse output
Python four methods will target a reverse output
will use it to illustrate the list:
>>> lst = [1,2,3,4,5,6] # Creating list of Test # Method. 1: >>> lst.reverse () #reverse () inverted >>> LST [. 6,. 5,. 4 , 3, 2, 1] method # 2: >>> LST1 = [I for I in the reversed (LST)] #reversed only applies to the sequence (a list of tuples, string) >>> LST1 [. 6,. 5 , 4, 3, 2, 1] method # 3: >>> lst2 the sorted = (LST, Reverse = True) # + Reverse applied to the sorted sequence (list, tuple, string), sets, dictionary >>> lst2 [6, 5, 4, 3, 2, 1] method # 4: >>> lst3 LST = [:: - 1] # slice usage: create a string with the reverse order of the original string >>> lst3 [6 , 5, 4, 3, 2, 1]
Python four methods will target a reverse output
will use it to illustrate the list:
>>> lst = [1,2,3,4,5,6] # Creating list of Test # Method. 1: >>> lst.reverse () #reverse () inverted >>> LST [. 6,. 5,. 4 , 3, 2, 1] method # 2: >>> LST1 = [I for I in the reversed (LST)] #reversed only applies to the sequence (a list of tuples, string) >>> LST1 [. 6,. 5 , 4, 3, 2, 1] method # 3: >>> lst2 the sorted = (LST, Reverse = True) # + Reverse applied to the sorted sequence (list, tuple, string), sets, dictionary >>> lst2 [6, 5, 4, 3, 2, 1] method # 4: >>> lst3 LST = [:: - 1] # slice usage: create a string with the reverse order of the original string >>> lst3 [6 , 5, 4, 3, 2, 1]