+ 1
What's that ??
lst = [10, 11, 12, 13, 14, 15] lst.reverse() print("Using reverse() ", lst) Â print("Using reversed() ", list(reversed(lst)))
2 Answers
+ 13
Gaurav K ,
> for the second try with reversed(), we should use the same basic data as for reverse().
> currently the second try uses an already reversed list from the first try
lst = [10, 11, 12, 13, 14, 15]
lst.reverse()
print("Using reverse() ", lst)
lst = [10, 11, 12, 13, 14, 15]
print("Using reversed() ", list(reversed(lst)))
> both results are giving the same output of: [15, 14, 13, 12, 11, 10]
+ 2
Thanku