It is no news that most wizards in the programming community, even accomplished polyglots do not like Python due to its weird(?) way of doing things. Still, hey, technology is all about innovation and change.
Some things to note though when working with arrays in Python:
- They are called lists.
- There are other types of arrays that are similar, but different from lists, like tuples, dictionaries,...
- Know the syntax for instantiating a list, e.g., [1, 2, 3, 4], [1] + [2] * [3].
- Know how to use the functions
insert
,append
, andremove
, and do not be afraid to use them if you cannot do the operations manually. It's all about innovation and using the libraries and functions already provided instead of trying to reinvent the wheel, unless you are asked not to (looking at you, C). - Know how to instantiate a 2D array, e.g., [[1, 2, 3], [4, 5, 6], [7, 8]].
- Checking if a value is present in an array is as simple as
i
inarr
. - Understand how copy and deep copy work, the difference between the two, and when to use them. E.g., A = B and A = list(B), where
B(list)
is a different copy ofB
(more on that in the future). - Slice is your best bud, use it wisely.
There may be some unmentioned here, but if you know any, I appreciate it if you could share.
Top comments (0)