Created
October 12, 2022 13:39
-
-
Save RaMSFT/d291fc7e58bb0628ee74fe210de5ccb7 to your computer and use it in GitHub Desktop.
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 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