This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decrypt_shift_right(decode_str): | |
"""Decode the given string (a step up the alphabest) | |
a -> c | |
b -> d | |
... | |
k -> m | |
o -> q | |
e -> g | |
.. | |
z -> b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decrypt_shift_right_trans(decode_str): | |
"""Decode the given string (a step up the alphabest) | |
a -> c | |
b -> d | |
... | |
k -> m | |
o -> q | |
e -> g | |
.. | |
z -> b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encrypt_shift_left_trans(decode_str): | |
"""encode the given string (a step down to next alphabest) | |
a <- c | |
b <- d | |
... | |
k <- m | |
o <- q | |
e <- g | |
.. | |
z <- b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encrypt_shift_left(decode_str): | |
"""encode the given string (a step down to next alphabest) | |
a <- c | |
b <- d | |
... | |
k <- m | |
o <- q | |
e <- g | |
.. | |
z <- b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_elemnt_in_list(input_list, value): | |
if value in input_list: | |
return f"Given value: {value} exists in the list" | |
else: | |
return f"Given value: {value} doesn't exists in the list" | |
print(check_elemnt_in_list(["hi", "edabit", "fgh", "abc"], 'fgh')) | |
print(check_elemnt_in_list(["Red", "blue", "Blue", "Green"], 'blue')) | |
print(check_elemnt_in_list(["a", "g", "y", "d"], 'd')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_element_with_index(input_list, index_value): | |
try: | |
return f"Element value: {input_list[index_value]} at the index: {index_value}" | |
except: | |
return f"no element exists at the index {index_value}" | |
print(find_element_with_index(["hi", "edabit", "fgh", "abc"], 1)) | |
print(find_element_with_index(["Red", "blue", "Blue", "Green"], 2)) | |
print(find_element_with_index(["a", "g", "y", "d"], 10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_index(input_list, search_str): | |
try: | |
val = input_list.index(search_str) | |
return f"index of {search_str} is {val}" | |
except: | |
return f"index of {search_str} is not found" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_index(input_list, search_str): | |
for val in range(0, len(input_list)): | |
if input_list[val] == search_str: | |
return f"index of {search_str} is {val}" | |
return f"index of {search_str} is not found" | |
print(find_index(["hi", "edabit", "fgh", "abc"], 'fgh')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def string_to_list(split_str): | |
result_list = list(split_str) | |
return result_list | |
print(string_to_list('Hello This is Python')) | |
print(string_to_list('Python')) | |
print(string_to_list('Edabit')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list_to_string(lst): | |
#Given list might contain numerics also, hence, convert each element into the string | |
#This can be done with loops also, using map to do it here | |
str_list = list(map(str, lst)) | |
#Using join to add all elements together into a string | |
result_str = ''.join(str_list) | |
return result_str |
NewerOlder