Forked from mingrammer/for-repeatedly-extending-the-list-type-containers.py
Created
October 11, 2018 15:32
-
-
Save neenjaw/3fe205082b65f545d3c24a84b5743805 to your computer and use it in GitHub Desktop.
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
# Initialize the zero-valued list with 100 length | |
zeros_list = [0] * 100 | |
# Declare the zero-valued tuple with 100 length | |
zeros_tuple = (0,) * 100 | |
# Extending the "vector_list" by 3 times | |
vector_list = [[1, 2, 3]] | |
for i, vector in enumerate(vector_list * 3): | |
print("{0} scalar product of vector: {1}".format((i + 1), [(i + 1) * e for e in vector])) | |
# 1 scalar product of vector: [1, 2, 3] | |
# 2 scalar product of vector: [2, 4, 6] | |
# 3 scalar product of vector: [3, 6, 9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment