Skip to content

Commit c8a2c35

Browse files
committed
Update .gitignore to exclude specific directories
0 parents  commit c8a2c35

26 files changed

Lines changed: 2183 additions & 0 deletions

String/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore directories in the parent directory
2+
../.vs/
3+
../Full Practice Python/
4+
../Patterns/
5+
../Python3 + HTML5/
6+
../Tests/
7+
../convertion/

String/.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"files.autoSave": "afterDelay",
3+
"editor.fontSize": 16
4+
}

String/All.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# def indexes(string, substring):
2+
# l = []
3+
# length = len(string)
4+
# index = 0
5+
# while index < length:
6+
# i = string.find(substring, index)
7+
# if i == -1:
8+
# return l
9+
# l.append(i)
10+
# index = i + 1
11+
# return l
12+
# s = "substring in python"
13+
# print(indexes(s, 'i'))
14+
15+
# Rewrite the code above without using def functions
16+
17+
# no def function
18+
19+
# s = input("substring in python: ")
20+
# substring = 'i'
21+
# l = []
22+
# substring_length = len(substring)
23+
24+
# for i in range(len(s) - substring_length + 1):
25+
# if s[i:i + substring_length] == substring:
26+
# l += [i] # Concatenating the list with a new list containing the index
27+
28+
# print(l)
29+
30+
31+
32+
string = "substring in python format"
33+
substring = input("character of string: ")
34+
l = []
35+
substring_length = len(substring)
36+
37+
for i in range(len(string) - substring_length + 1):
38+
match = True
39+
for j in range(substring_length):
40+
if string[i + j] != substring[j]:
41+
match = False
42+
if match:
43+
l += [i] # Concatenating the list with a new list containing the index
44+
45+
print(l)
46+

0 commit comments

Comments
 (0)