Created
June 29, 2020 23:14
-
-
Save JohnsonLuu/572fa757e5a1db15efb1aec3a72c8670 to your computer and use it in GitHub Desktop.
More and More String Slicing (How Long is that String?)
This file contains 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
first_name = "Reiko" | |
last_name = "Matsuki" | |
def password_generator(first_name, last_name): | |
# -1 gives you the final index of a string | |
# -3 will thus give you the 3rd index before the end | |
# print(first_name[len(first_name)-3:] + last_name[len(last_name)-3:]) | |
return first_name[len(first_name)-3:] + last_name[len(last_name)-3:] | |
temp_password = password_generator(first_name, last_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment