Skip to content

Commit aba51e6

Browse files
✨ std_lib: reverse iterables
1 parent 9af3181 commit aba51e6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

standard_lib/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ A collection of useful snippets using only the standard library.
5858
| regular_expression_debug | Display debug information about the compiled regular expression with re.DEBUG flag |
5959
| remove_duplicates_list | Remove duplicates from list and keep the order |
6060
| remove_elements_list | Remove elements not matching certain pattern - the fast way! |
61+
| reverse_iterables | Reverse an iterable using `reversed()` |
6162
| save_dict_update_without_loosing_original | Update dict value without loosing original value |
6263
| scopes_namespaces | Reveils the differences between `global`, `local`, and `nonlocal` |
6364
| set_union_intersection | Use \| and & for set union and intersection |

standard_lib/reverse_iterables.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
names = ["Lea", "Mario", "Nicole"]
2+
3+
for name in reversed(names):
4+
print(name)

0 commit comments

Comments
 (0)