From 911e5a3bd8eb27203fc5f0eee673ea38cf87c522 Mon Sep 17 00:00:00 2001 From: Lukas Baumann Date: Wed, 17 Feb 2021 14:06:33 +0100 Subject: [PATCH] Create 7 - Searching a Nested List.py --- 16/7 - Searching a Nested List.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 16/7 - Searching a Nested List.py diff --git a/16/7 - Searching a Nested List.py b/16/7 - Searching a Nested List.py new file mode 100644 index 0000000..bccf251 --- /dev/null +++ b/16/7 - Searching a Nested List.py @@ -0,0 +1,9 @@ +def nestedListContains(NL, target): + if isinstance(NL, int): + if NL == target: + return True + return False + for i in NL: + if nestedListContains(i, target): + return True + return False