From a167cd3f29fb06fe1505019bd5ed7c2267343814 Mon Sep 17 00:00:00 2001 From: Kirandeep12 <34632491+Kirandeep12@users.noreply.github.com> Date: Wed, 2 Oct 2019 15:03:30 -0400 Subject: [PATCH 1/2] Update isSubstring.py --- isSubstring.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/isSubstring.py b/isSubstring.py index 5e2c326..54622b3 100644 --- a/isSubstring.py +++ b/isSubstring.py @@ -5,3 +5,11 @@ def isSubstring(s,s1): return True print isSubstring("anumsharma","ar") + +####### Another Method ##### + +def isSubstring(s,s1): + if s.find(s1) != -1: + return True + +print (isSubstring("anumsharma","ar")) From 87e8303a6f9072ad6c10617092851e1b1371610c Mon Sep 17 00:00:00 2001 From: Kirandeep12 <34632491+Kirandeep12@users.noreply.github.com> Date: Wed, 2 Oct 2019 15:56:08 -0400 Subject: [PATCH 2/2] Update removing_the_values_at_index.py --- removing_the_values_at_index.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/removing_the_values_at_index.py b/removing_the_values_at_index.py index a603dfb..c456280 100644 --- a/removing_the_values_at_index.py +++ b/removing_the_values_at_index.py @@ -6,3 +6,11 @@ lists= [12,24,35,70,88,120,155] lists= [x for (i,x) in enumerate(lists) if i not in (0,4,5)] print lists # [24, 35, 70, 155] + +##### Another Method ##### + +list = [12,24,35,70,88,120,155] +indices = {0,4,5} +for index in sorted(indices, reverse=True): + del list[index] +print(list) # [24, 35, 70, 155]