#can someone who is proficient in Python
1 messages · Page 1 of 1 (latest)
I understand it as creating an array of arrays, with a fixed size of whatever the length of nums is
thank you, its just confusing LOL. in Swift, I can just say this:
var freqArray = [[Int]](repeating: [], count: nums.count)
which is easier to understand
Python often trips over itself with stuff like this tbh
One of the reasons I really dont like it
Yeah, it feels like overkill tbh.
that type of statement is called a "list comprehension"; there are a few other languages with similar equivalents such as Elixir, but yeah they're a bit unique. I absolutely felt they were unnecessary and over the top when i was learning python, but now that it's been a few years it's like "omg you can have my comprehensions when you tear them from my cold dead hands"
yeah, i can see them as useful, but feels so over-the-top for me coming from swift