Answers for "Reverse iteration"

0

Reverse iteration

# use reversed() to loop over sequence in reverse
for i in reversed(range(1, 10, 2)):
  print(i, end=', ')

# =>
# 9, 7, 5, 3, 1,
Posted by: Guest on October-08-2021

Browse Popular Code Answers by Language