11th Jul 2019, 10:38 AM
PRO
PRO - avatar
4 ответов
+ 7
reversed() method returns an iterator (not a list) that accesses the given sequence in the reverse order To make a list from the iterator use list() function Use new_list2 = list(reversed(tech_wishlist)) Instead of new_list2 = reversed(tech_wishlist)
11th Jul 2019, 10:54 AM
Om Kumar
Om Kumar - avatar
+ 1
Om Kumar what is an iterator?
11th Jul 2019, 10:55 AM
PRO
PRO - avatar
0
some options here new_list2 = tech_wishlist[::-1] print(new_list2) for i in reversed(tech_wishlist): print(i) tech_wishlist.reverse() print(tech_wishlist)
11th Jul 2019, 8:53 PM
Choe
Choe - avatar