Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
00c22a3
Added censor function
meg-1 May 16, 2021
4194344
Added censor code
meg-1 May 17, 2021
e7d4102
Added comments to the code
meg-1 May 17, 2021
93bd4ac
modified censor function
meg-1 May 22, 2021
b714278
added decrypt function
meg-1 Aug 1, 2021
c879c7f
added cypher and decypher functions, deleted censor and decrypt funct…
meg-1 Aug 4, 2021
e60dd6f
Deleted decrypt.py
meg-1 Aug 4, 2021
b3e0cb8
Deleted censor.py
meg-1 Aug 4, 2021
e14b9ef
Merge branch 'TheAlgorithms:master' into master
meg-1 Aug 4, 2021
947f7d8
edited the crypt and decrypt files
meg-1 Aug 4, 2021
daf21ad
Update cypher_txt.py
meg-1 Aug 4, 2021
d3d8b29
Remove the endline in cypher.py
meg-1 Aug 4, 2021
752c197
Removed the print at the end of decypher.py
meg-1 Aug 4, 2021
9f44028
comitting changes
meg-1 Aug 18, 2021
f72431b
added 4 new algorithms
meg-1 Aug 18, 2021
4c891f4
added tests to the four files
meg-1 Aug 25, 2021
c600b10
added type hints for the function variables
meg-1 Aug 25, 2021
4286e40
Merge branch 'TheAlgorithms:master' into master
meg-1 Dec 11, 2021
7a909e2
Deleted decode message
meg-1 Dec 25, 2021
f5b5411
Deleted code message
meg-1 Dec 25, 2021
bc8388c
Welford average algorithm
meg-1 Jan 29, 2022
9be479e
added average welford algorithm
meg-1 Feb 9, 2022
5ebf785
indentation added
meg-1 Mar 26, 2022
0570692
switched print to return in the end
meg-1 Mar 26, 2022
b589177
added digital_root function
meg-1 May 7, 2022
16f087f
re-opened the digital root pr
meg-1 May 11, 2022
f5b37ac
deleting average_welford
meg-1 May 11, 2022
218f0de
deleting censor.py
meg-1 May 11, 2022
3ecf247
deleting decrypt.py
meg-1 May 11, 2022
669a12c
fixed mistakes sum_of_digits
meg-1 May 18, 2022
b49257b
fixed "sum_of_digits.py"
meg-1 Jun 1, 2022
8c4653c
fix black
poyea Jun 11, 2022
4e09780
fixing Value Error
meg-1 Jun 15, 2022
fbec04e
adding tests to digital_root
meg-1 Jun 22, 2022
901c4fa
Update maths/sum_of_digits.py
meg-1 Jul 9, 2022
c56f3f1
fixing return type
meg-1 Jul 9, 2022
bd8dd3f
fixing tests in digital_root
meg-1 Jul 9, 2022
67eca3a
enhancing maths/sum_of_digits.py
meg-1 Jul 13, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added decrypt function
  • Loading branch information
meg-1 committed Aug 1, 2021
commit b7142782ae3376c5e66f2adf025d8e4a57e3f0d7
27 changes: 27 additions & 0 deletions strings/decrypt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def decrypt(txt, symbol):
#here we split the string we need to decypher into a list
txt_lst = txt.split()
res_str = ""
#we create a for loop which loops through the newly created list
for word1 in txt_lst:
#here we convert the current word we got through the loop into a list of charachters
word1_lst = list(word1)
#we loop through each charachter in the newly created list of charachters form the word we are looping throuh
for char1 in word1_lst:
#we set a condition, where if the symbol the loop is currently on corresponds to the symbol we need to remove, we stop on it and examine it
if char1 == symbol:
#we find the charachters index from the word
indx = word1.index(char1)
#we remove the list (the list which contains every element and characahter from the word we are looping throuh) element with the same index from the list.
word1_lst[indx] = ""
res_wrd = ""
#we loop throuh the list containing all the charachters from the word, and append those charachters to a new string
for char1 in word1_lst:
res_wrd += char1
#here we add the newly created, decyphered word to a new string which will contain our full result
res_str += res_wrd + " "
res_str = res_str[:-1]
#and here we print out the final result
print(res_str)

decrypt("o$ne t$wo three$", "$")