Skip to content

Instantly share code, notes, and snippets.

@JohnsonLuu
Created June 29, 2020 23:14
Show Gist options
  • Save JohnsonLuu/572fa757e5a1db15efb1aec3a72c8670 to your computer and use it in GitHub Desktop.
Save JohnsonLuu/572fa757e5a1db15efb1aec3a72c8670 to your computer and use it in GitHub Desktop.
More and More String Slicing (How Long is that String?)
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