Last active
December 27, 2018 11:21
-
-
Save artemrys/586e3ed7a62b7924192156eabccd46a8 to your computer and use it in GitHub Desktop.
Python multiplication magic
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
print(3 * 3) | |
# 9 | |
print((3).__mul__(3)) | |
# 9 | |
print("Abc" * 3) | |
# 'AbcAbcAbc' | |
print("Abc".__mul__(3)) | |
# 'AbcAbcAbc' | |
print(3 * "Abc") | |
# 'AbcAbcAbc' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment