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 i_hate_space(chr, stmt): | |
result = stmt.replace(' ',chr) | |
return result | |
print(i_hate_space("H", "Hello welcome to my Blog")) | |
print(i_hate_space("R", "python is fun")) | |
print(i_hate_space("#", "hello world!")) |
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 evaluate_equation(eq): | |
result = eval(eq) | |
return result | |
print(evaluate_equation("1+2")) | |
print(evaluate_equation("6/(9-7)")) | |
print(evaluate_equation("3+2-4")) |
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 long_burp(num): | |
burp_str = 'Burp' | |
long_r = 'r' * num | |
long_burp_str = burp_str.replace('r', long_r) | |
return long_burp_str | |
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 on_off_switch(switches): | |
# ** operator in Python works as power | |
posibilities = 2 ** switches | |
return posibilities | |
print(on_off_switch(1)) | |
print(on_off_switch(3)) | |
print(on_off_switch(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 check_number_in_list(lst, num): | |
if num in lst: | |
result = f"{num} exist in the list" | |
else: | |
result = f"{num} doesn't exist in the list" | |
return result | |
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 range_of_num(start, end): | |
if start < end: | |
result = list(range(start + 1, end)) | |
else: | |
result = "Wrong input..!! Range Start number must be Less than end number" | |
return result | |
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 num_to_dashes(num): | |
if num < 1 or num > 60: | |
return "Wrong input" | |
else: | |
return "-" * num | |
print(num_to_dashes(1)) | |
print(num_to_dashes(5)) | |
print(num_to_dashes(3)) |
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 strin_odd_or_even(str): | |
str_length = len(str) | |
if str_length % 2 == 0: | |
return True | |
else: | |
return False | |
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 concat_last_first_name(first, last): | |
full_name = f"{last}, {first}" | |
return full_name | |
print(concat_last_first_name("First", "Last")) | |
print(concat_last_first_name("John", "Nelluri")) |
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 is_string_empty_len(str): | |
str_len = len(str) | |
if str_len == 0: | |
return True | |
else: | |
return False | |
print(is_string_empty_len("a")) |