Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 12, 2022 13:39
Show Gist options
  • Select an option

  • Save RaMSFT/d291fc7e58bb0628ee74fe210de5ccb7 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/d291fc7e58bb0628ee74fe210de5ccb7 to your computer and use it in GitHub Desktop.
def comp_string_len(str1, str2):
"""Compare strings based on the length
Args:
str1 (string)
str2 (string)
Returns:
Boolean: return True if both strings are at same length
"""
str1_len = len(str1)
str2_len = len(str2)
if str1_len == str2_len:
return True
else:
return False
print(comp_string_len("AB","CD"))
print(comp_string_len("ABC","DE"))
print(comp_string_len("hello","edabit"))
print(comp_string_len("learn Python","Python Learning"))
print(comp_string_len("","A"))
print(comp_string_len("ABCDEF","DEFGHT"))
print(comp_string_len("ABZ","AAAAACD"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment