Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions isSubstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
8 changes: 8 additions & 0 deletions removing_the_values_at_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]