From 26100e1c1ecf20844807120f9cadd8ac8ee1e9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Sun, 2 Jul 2023 17:09:30 +0300 Subject: [PATCH] foreach example first class citizen --- python-temel/foreach.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 python-temel/foreach.py diff --git a/python-temel/foreach.py b/python-temel/foreach.py new file mode 100644 index 0000000..cddc96f --- /dev/null +++ b/python-temel/foreach.py @@ -0,0 +1,10 @@ +def foreach(l, f): + for x in l: + f(x) + +def foo(x): + print('foo: {}'.format(x)) + + +foreach([1, 2, 3, 4, 5], foo) +foreach([1, 2, 3, 4, 5], print)